Traffic Signal Phase Optimization
Traffic Signal Phase Optimization
HardArrays0% accepted
Bangalore traffic management uses arrays to represent vehicle counts at intersections every minute. A signal must be green for consecutive minutes where vehicle count increases strictly. Find the longest such phase to minimize congestion.
Approach
Given an array of N vehicle counts at an intersection, find the length of the longest subarray with strictly increasing values and return the sum of that subarray.
Input
N=7, counts=[2,3,5,7,4,6,8]
Output
4
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