Company: InMobi
Difficulty: medium
Cheapest Flights Within K Stops Problem Description You are given a network of n cities connected by m flights. Each flight has a source city, a destination city, and a price. Your task is to find the cheapest route from a given source city (src) to a destination city (dst) with at most k stops. If no such route exists, you should return -1. Input: Total number of cities, n. Total number of flights, m. Source city, src. Destination city, dst. Maximum number of stops allowed, k. The next m lines contain the flight details: source destination price. Output: Return a single integer representing the total cost of the cheapest route. Examples Example 1: Input: 6 8 0 3 1 0 1 10 0 2 10 0 3 15 0 4 2 1 3 20 2 3 50 4 5 2 5 3 2 Output: 15 Explanation: For the given input, we need to find the cheapest route from city 0 to city 3 with at most 1 stop. The path 0 -> 4 -> 5 -> 3 has a total cost of 2+2+2=6. However, it has 2 stops (at cities 4 and 5), which exceeds the limit of k=1. The path 0 -> 3 is