BackmediumUncategorized uncategorized medium

Optimal Traffic Allocation Solution

Problem Statement

Given an array of integers representing traffic volumes of different lanes, find the optimal allocation to minimize congestion by rearranging the traffic volumes. The congestion is calculated as the maximum traffic volume in any lane.

Example 1
Input
[4, 2, 7, 1]
Output
4

Explanation: The optimal allocation is achieved by sorting the traffic volumes, resulting in [1, 2, 4, 7] and a minimum congestion of 4

Constraints

  • 1 <= lanes <= 100
  • 1 <= trafficVolume <= 10000
  • The input array will not be empty
  • The input array will contain only non-negative integers
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