Maximum Delivery Distance Route
Maximum Delivery Distance Route
HardArrays0% accepted
Arjun manages deliveries at Blue Dart's Mumbai hub. Each package has a delivery distance, and his truck has capacity K. He needs to find the longest route where consecutive packages' total distance ≤ K to optimize fuel efficiency.
Approach
Given an array of delivery distances and capacity K, find the longest contiguous subarray with sum ≤ K.
Input
5 9
2 3 4 1 5
Output
3
More Arrays problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards