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.
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak