Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Bulb Switcher III
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Given an array representing bulb states, count moments when all turned-on bulbs are blue.
Sample Input:
[2,1,3,5,4]
Sample Output:
3
Hints
Hint 1
Track the maximum bulb number turned on so far
Hint 2
If current position + 1 equals max, all bulbs up to current are blue
Hint 3
Count these moments
Code Editor
Reset
Run
Save
Loading...