Python Binary Search O(NlogN) "threshold" is smokescreen
Intuitionthreshold is there to confuse you and nothing else. Why? Because we just need to pick 1 outgoing edge from any nodes at most to meet all the requiremen
# Intuition
`threshold` is there to confuse you and nothing else. Why? Because we just need to pick 1 outgoing edge from any nodes at most to meet all the requirements.

Proof is that if we have `[node_A, node_C, weight_0]` and `[node_B, node_C, weight_1]`, we just need one of these two edges because:
1. whether `node_A, node_B` can be reached from `0` has nothing to do with `node_B`, so whichever edge we pick won't affect any edges we pick for `node_A, node_B`.
2. This means `node_A, node_B` mus be reachable from `0` by some other edges and it also means, regardless of which edge we pick here for `node_C`, `node_C` will be rechable from `0`.
3. Hence we just need to pick the edge that satisifies `weight_x < max_weight`

# Approach
Binary search.

# Complexity
- Time complexity:
O(NlogN)

- Space complexity:
O(N)

# Code
```python3 []
class Solution:
    def minMaxWeight(self, n: int, edges: List[List[int]], threshold: int) -> int:
        graph = [[] for _ in range(n)]
        for e in edges:
            # flip the edge
            graph[e[1]].append((e[0], e[2]))

        def check(weight):
            stack = [0]
            seen = [False] * n
            seen[0] = True
            while stack:
                node = stack.pop(-1)
                for nei, w in graph[node]:
                    if seen[nei]: continue
                    if w > weight: continue
                    seen[nei] = True
                    stack.append(nei)
            return seen.count(False) == 0

        max_edge = max(e[2] for e in edges)
        left, right = 1, max_edge
        while left <= right:
            mid = (left + right) // 2
            if check(mid):
                right = mid - 1
            else:
                left = mid + 1
        if left > max_edge: return -1
        else: return left
```
['Python3']