#3842

Toggle Light Bulbs

newbie · 275 · lc easy +19 · 71.8% accepted · 54 likes · top 81%

Description

There are 100 light bulbs numbered 1 through 100, all initially off. You are given an array bulbs of integers (each between 1 and 100). For each value bulbs[i], toggle the corresponding bulb's state (off becomes on, on becomes off). Return the sorted list of bulb numbers that are on after processing all toggles. Return an empty list if no bulbs remain on.

Code

1
2
3