Minimum Delivery Cost Between Cities

Last updated: July 3, 2026

Quick Overview

The question asks the candidate to determine the minimum delivery cost between cities given a set of routes and their respective costs.

Uber
Coding & Algorithms
Software Engineer
Uber
July 3, 2026
Software Engineer
Online Assessment
Coding & Algorithms
Medium

17

0

133 solved


The question asks the candidate to determine the minimum delivery cost between cities given a set of routes and their respective costs.

This question is typically asked during the online assessment round for software engineering candidates at Uber to evaluate their problem-solving and algorithmic skills. The interviewer is looking for the candidate's ability to apply graph theory concepts, particularly in finding the shortest path in a weighted graph, which is a common scenario in logistics and transportation applications.

What the Interviewer Expects
  • Demonstrates understanding of graph representation and traversal algorithms.
  • Clearly explains the chosen algorithm for finding the minimum cost.
  • Provides a correct and efficient implementation of the solution.
  • Discusses time and space complexity of the solution.
  • Considers edge cases and potential pitfalls in the implementation.
Key Topics to Cover
Graph Theory
Shortest Path Algorithms
Dijkstra's Algorithm
Complexity Analysis
Edge Cases
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • What would you do if there were negative weights on the edges?
  • How would you optimize your solution for larger datasets?
  • Can you explain how your solution could be adapted for real-time delivery tracking?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Approach

To solve the problem of finding the minimum delivery cost between cities, I will represent the cities and routes as a graph. Each city will be a node, and each route with its cost will be an edge with...

Algorithm
  1. Initialize a priority queue to store the cities to explore, starting with the source city.
  2. Create a dictionary to track the minimum cost to reach each city, initializing the source city cost to ...

Submit Your Answer
Markdown supported

Related Questions