Easy Sol
IntuitionApproachOnce a node is visited this means a edge is reaching the node and so if some other edge also reaches the same node it is of no use just we have
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
Once a node is visited this means a edge is reaching the node and so if some other edge also reaches the same node it is of no use just we have to ignore this as we have already visited the node and so we are doing during the dfs part

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    void dfs(int i,vector<vector<pair<int,int>>>&graph,vector<int>&st,int wght){
        if(st[i]){
            return;
        }
        st[i]=1;
        for(auto [v,w]:graph[i]){
            if(w>wght)continue;
            dfs(v,graph,st,wght);
        }
    }
    int minMaxWeight(int n, vector<vector<int>>& edges, int threshold) {
      
        int ans=-1;
        int l=0;
        int h=1e6+10;
            vector<vector<pair<int,int>>>graph(n);
            for(auto i:edges){
                int u=i[0];
                int v=i[1];
                int w=i[2];
                graph[v].push_back({u,w});
            }
        auto check = [&](int mid){
            vector<int>edge(n);
            vector<int>st(n);
            dfs(0,graph,st,mid);
            if(all_of(st.begin(),st.end(),[](int x){
                return x==1;
            }))return 1;
            return 0;
        };
        while(l<=h){
            int mid=(l+h)/2;
            if(check(mid)){
                ans=mid;
                h=mid-1;
            }
            else{
                l=mid+1;
            }
        }
         return ans;
    }
};
```
['Binary Search', 'Greedy', 'Depth-First Search', 'Graph', 'Sorting', 'C++']