Python3 || weighted bin search || T/S: 56% / 22%
https://leetcode.com/problems/minimize-the-maximum-edge-weight-of-graph/submissions/1506554505/I could be wrong, but I think that time complexity is O(N ^2 * lo


```python3 []
class Solution:
    def minMaxWeight(self, n: int, edges: List[List[int]], threshold: int) -> int:

        def dp(mx_wgt: int, end: int, seen: List)-> int:

            seen[end] = res = 1

            for beg, wgt  in graph[end]:
                if seen[beg]: continue
                if wgt <= mx_wgt:
                    res+= dp(mx_wgt, beg, seen)
 
            return res


        graph = [[] for _ in range(n)]
        for beg, end, wgt in edges:
            graph[end].append((beg, wgt))

        _, _, wgts = zip(*edges)
        wgt_lim = max(wgts) + 1
        left, rght = 1, wgt_lim
        
        while left < rght:

            mid = (left + 2 * rght) // 3
            if dp(mid, 0, [0] * n) == n: rght = mid
            else: left = mid + 1

        return left if left < wgt_lim else -1
```
[https://leetcode.com/problems/minimize-the-maximum-edge-weight-of-graph/submissions/1506554505/](https://leetcode.com/problems/minimize-the-maximum-edge-weight-of-graph/submissions/1506554505/)

I could be wrong, but I think that time complexity is *O*(*N* ^2 * log(*W*)) and space complexity is *O*(*N*^2), in which *N* ~ `n` and *W* ~ `wgt_lim`.
['Python3']