BackmediumUncategorized uncategorized medium

Optimal Speed Limit Adjustment Solution

Problem Statement

You are given an array of integers representing the number of vehicles in each segment and an array of integers representing their average speeds. The road is divided into segments, each with its own speed limit. Determine the optimal speed limits for each segment to minimize congestion. The function should take as input two arrays: `vehicles` and `avg_speeds`, both of length `n`, where `n` is the number of segments. The function should return an array of length `n`, where each element is the optimal speed limit for the corresponding segment.

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