BackmediumUncategorized uncategorized medium

Optimal Lane Speed Allocation Solution

Problem Statement

Given an array of integers representing the speed of each lane and the number of lanes, determine the optimal lane allocation to minimize travel time and congestion.

Example 1
Input
[5, 10, 15, 20, 25]
Output
[0, 1, 2, 3, 4]

Explanation: Allocate the first vehicle to the first lane, the second vehicle to the second lane, and so on.

Constraints

  • The input array length should be equal to the number of lanes
  • All input values should be greater than zero
  • The number of lanes should be a positive integer
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free