Description
Solutions
Delivery Management System (QR Intern)
π€ INTERNπRELATED PROBLEMS
A manufacturing company is located in a certain city. Their goods need to be shipped to other cities that are connected with bidirectional roads, though some cities may not be accessible because roads don't connect to them. The order of deliveries is determined first by distance, then by priority. Given the number of cities, their connections via roads, and what city the manufacturing company is located in, determine the order of cities where the goods will be delivered.
Example 1:
Input: cityNodes = 4, cityFrom = [1, 2, 2], cityTo = [2, 3, 4], company = 1
Output: [2, 3, 4]
Explanation:The closest city to the manufacturing company is city 2, which is 1 unit away. The next-closest cities are city 3 and city 4, which are both 2 units away. Since city 3 has a smaller number than city 4, it is visited first, followed by city 4. Thus, the order of delivery is [2, 3, 4].
Constraints:
ππ

Related Problems
Testcase
Result
Case 1
input:
output: