Simple Java solution using graph concepts
ApproachUsing a priority queue to explore the cities, always choosing the path with the lowest cost first.
Started from city 0, keeping track of the time and co

# Approach
<!-- Describe your approach to solving the problem. -->
Using a priority queue to explore the cities, always choosing the path with the lowest cost first.
Started from city 0, keeping track of the time and cost for each path, and only continuing if the total time stays within the allowed limit.

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

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

# Code
```java []
import java.util.*;

class Solution {
    public int minCost(int maxTime, int[][] edges, int[] passingFees) {
        int n = passingFees.length;
        
        List<int[]>[] graph = new ArrayList[n];
        for (int i = 0; i < n; i++) {
            graph[i] = new ArrayList<>();
        }
        for (int[] edge : edges) {
            graph[edge[0]].add(new int[]{edge[1], edge[2]});
            graph[edge[1]].add(new int[]{edge[0], edge[2]});
        }
        
        PriorityQueue<int[]> pq = new PriorityQueue<>((a, b) -> a[0] - b[0]);
        pq.offer(new int[]{passingFees[0], 0, 0});
        
        int[] minTime = new int[n];
        Arrays.fill(minTime, Integer.MAX_VALUE);
        minTime[0] = 0;
        
        while (!pq.isEmpty()) {
            int[] curr = pq.poll();
            int cost = curr[0], node = curr[1], time = curr[2];
            
            if (node == n - 1) {
                return cost;
            }
            
            for (int[] neighbor : graph[node]) {
                int nextNode = neighbor[0], travelTime = neighbor[1];
                int newTime = time + travelTime;
                
                if (newTime <= maxTime && newTime < minTime[nextNode]) {
                    minTime[nextNode] = newTime;
                    pq.offer(new int[]{cost + passingFees[nextNode], nextNode, newTime});
                }
            }
        }
        
        return -1;
    }
}

```
['Array', 'Dynamic Programming', 'Java']