Greedy | No Binary Search | No PriorityQueue 
Greedy 99% Runtime | No Binary Search | No Priority QueueObservations1 - Checking whether every node is reachable from 0 is suffice.
2 - One outgoing edge from
# Greedy 99% Runtime | No Binary Search | No Priority Queue
# Observations
<!-- Describe your first thoughts on how to solve this problem. -->
1 - Checking whether every node is reachable from 0 is suffice.
2 - One outgoing edge from each node is suffice to reach to a node which can either reach to 0 or is itself 0. Hence the condition on the edges in the graph being at most threshold is just a distraction.
 3 - As threshold is given to us in the range [1, n - 1]. Hence in all cases threshold >= 1 is safe and we can always have one outgoing edge (which is sufficient) to make our graph.



# Approach
1 - First of all create an adjacenecy graph with original source acting as destination and vice versa. Keep the weight edge as it is.
2 - Create a vis array (for avoiding stack overflow while dfs traversal).
3 - Create a minMaxWeight array managing the minimum value of maximum weight path from 0 to each node.
4 - Initialize the above array with +INFINITY or INT_MAX or Integer.MAX_VALUE
5 - Perform a dfs tarversal on the graph with starting node 0 and explore all edges and maintain a variable (maxWeightAlongPath) that tracks maximum of weight across the path. 
6 - Optimization -> If at any stage we get maxWeightAlongPath incapabale of minimizing minMaxWeight[destination] we simply backtrack and explore other paths.
7 - Take maximum of the weight of minMaxWeight array and if either is unreachable then maximumValue will be INT_MAX hence return -1 else return maximumValue;
# Complexity
- Time complexity:
- O(v + E)

- Space complexity:
- O(V + E)

# Code
```java []
class Solution {
    private static void minMaxWeightUtil(ArrayList<int[]>[] graph, boolean[] vis, int curr, int maxWeightAlongPath,
            int[] minMaxWeight) {

        vis[curr] = true;

        for (int[] edge : graph[curr]) {

            int w = edge[1];
            int v = edge[0];

            int currUpdatedMaxWeight = Math.max(w, maxWeightAlongPath);

            if (currUpdatedMaxWeight >= minMaxWeight[v]) {
                continue;
            }

            minMaxWeight[v] = Math.min(minMaxWeight[v], currUpdatedMaxWeight);

            if (!vis[v]) {
                minMaxWeightUtil(graph, vis, v, currUpdatedMaxWeight, minMaxWeight);
            }

        }

        vis[curr] = false;

    }

    public int minMaxWeight(int n, int[][] edges, int threshold) {

        var graph = (ArrayList<int[]>[]) new ArrayList[n];
        var vis = new boolean[n];
        var minMaxWeight = new int[n];
        var q = new LinkedList<int[]>();

        Arrays.fill(minMaxWeight, Integer.MAX_VALUE);

        minMaxWeight[0] = 0;

        for (int idx = 0; idx < n; ++idx) {
            graph[idx] = new ArrayList<>();
        }

        for (int[] edge : edges) {
            graph[edge[1]].add(new int[] { edge[0], edge[2] });
        }

        int maxDistance = 0;

        minMaxWeightUtil(graph, vis, 0, 0, minMaxWeight);

        for (int w : minMaxWeight) {
            maxDistance = Math.max(maxDistance, w);
        }

        return maxDistance == Integer.MAX_VALUE ? -1 : maxDistance;

    }
}
```
['Greedy', 'Depth-First Search', 'Java']