Question bank › Greedy
Dsa Greedy Hard

Parcel Delivery Route Optimization

You are tasked with optimizing the delivery route for a courier service. Each delivery point has an associated distance, and you want to find the minimum total distance required to deliver parcels to a set of points ensuring you only visit each point once. Input Format: - The first line contains an integer N (1 <= N <= 1000), the number of delivery points. - The second line contains N space-separated integers, each indicating the distance to the respective delivery point (1 <= distance <= 10000). Output Format: - Print a single integer representing the minimum total distance to complete all deliveries. Example: Input: 4 10 20 15 5 Output: 50 In this case, the best route is to deliver to the points in the order of distances 5, 10, 15, and 20 for a total distance of 50.

Key concepts

greedyoptimizationgraph theory

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.