faster than 70% || easy solution c++ || ignore threshold with explanation
Explanationwe dont need to consider threshold because lets say there is a directed edge between a and b it is useful only when it is reachable to node 0 else we
# Explanation 
we dont need to consider threshold because lets say there is a directed edge between a and b it is useful only when it is reachable to node 0 else we can remove it, now the question boils down to finding minimum wt so that all the weight present in the graph are less than or equal to the wt and from every node we can reach zero, this we can do with binary search. 

# Code
```cpp []
class Solution {
public:
    int ans = INT_MAX;
    bool good(int mid, int n, int th, vector<vector<pair<int, int>>>& graph) {

        vector<bool> vis(n, false);
        queue<int> qu;
        qu.push(0);
        while (!qu.empty()) {
            int top = qu.front();
            qu.pop();

            if (vis[top]) {
                continue;
            }
            vis[top] = true;

            for (auto& nb : graph[top]) {

                if (!vis[nb.first] and nb.second <= mid) {
                    qu.push(nb.first);
                }
            }
        }

        for (int i = 1; i < n; i++) {
            if (not vis[i]) {
                return false;
            }
        }

        return true;
    }
    int minMaxWeight(int n, vector<vector<int>>& edges, int threshold) {

        int lo = 0, hi = 0;
        vector<vector<pair<int, int>>> graph(n);

        for (auto& edge : edges) {
            int a = edge[0];
            int b = edge[1];
            int wt = edge[2];
            graph[b].push_back({a, wt});
            hi = max(hi, edge[2]);
        }
        int res = -1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;

            if (good(mid, n, threshold, graph)) {
                hi = mid - 1;
                res = mid;
            } else {
                lo = mid + 1;
            }
        }
        if (res == -1)
            return -1;
        return res;
        // we dont need to consider threshold because lets say there is a directed edge between a and b it is useful only when it is reachable to node 0 else we can remove it 
    }
};
```
['C++']