PriorityQueue
IntuitionIgnore thresholdApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Ignore threshold
# Approach
<!-- Describe your approach to solving the problem. -->

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

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

# Code
```csharp []
public class Solution {
    public int MinMaxWeight(int n, int[][] edges, int threshold) {
        List<(int, int)>[] adjW = new List<(int, int)>[n];

            // Build adjecent
			for (int i = 0; i < n; i++)
			{
				adjW[i] = new List<(int, int)>();
			}

			foreach (int[] edge in edges)
			{
				int from = edge[0], to = edge[1], w = edge[2];
				adjW[from].Add((to, w));
			}

			for (int i = 0; i < n; i++)
			{
				int cnt = adjW[i].Count;
				if (i > 0 && cnt == 0)
					return -1;
			}

			Dictionary<int, int> dp = new();
			int maxW = 0;
			for (int i = 1; i < n; i++)
			{
				// BFS from i to 0
				PriorityQueue<int, int> pq = new();
				int minW = int.MaxValue;
				pq.Enqueue(i, 0);
				HashSet<int> visited = new();
				while (pq.TryDequeue(out int node, out int w))
				{
                    if(w > minW)
                        continue;

					if (node == 0)
					{
						minW = w;
						break;
					}

					if (dp.ContainsKey(node))
					{
						minW = Math.Min(minW, Math.Max(w, dp[node]));
						break;
					}

					visited.Add(node);
					foreach (var nextN in adjW[node])
					{ 
						int nextNode = nextN.Item1, nextW = nextN.Item2;
						if (visited.Contains(nextNode))
							continue;

						pq.Enqueue(nextNode, Math.Max(w, nextW));
					}
				}
				if (minW == int.MaxValue)
					return -1;

				dp.Add(i, minW);

				maxW = Math.Max(maxW, minW);
			}

			return maxW;
    }
}
```
['C#']