Tap here to switch tabs
Problem
Submissions

Problem: Toggle Light Bulbs

med
30 min
Try to solve the Toggle Light Bulbs problem.

Statement

You are given an integer array bulbs representing a sequence of operations on light bulbs, where all light bulbs are initially turned off.

For each bulb identifier in bulbs, toggle its state: if the bulb is off, switch it on, and if it is on, switch it off.

Return an array containing the identifiers of all light bulbs that remain turned on at the end, sorted in ascending order.

Constraints:

  • 1≤1 \leq bulbs.length ≤100\leq 100

  • 1≤1 \leq bulbs[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Toggle Light Bulbs

med
30 min
Try to solve the Toggle Light Bulbs problem.

Statement

You are given an integer array bulbs representing a sequence of operations on light bulbs, where all light bulbs are initially turned off.

For each bulb identifier in bulbs, toggle its state: if the bulb is off, switch it on, and if it is on, switch it off.

Return an array containing the identifiers of all light bulbs that remain turned on at the end, sorted in ascending order.

Constraints:

  • 1≤1 \leq bulbs.length ≤100\leq 100

  • 1≤1 \leq bulbs[i] ≤100\leq 100