Prime Factor Visitation

Problem Overview

  • Compute final on/off states of bulbs in a row after processing a list of numbers.
  • For each number, toggle bulbs at positions equal to its prime factors; return the final states array.
  • Input: initial states array (0/1, length n) and numbers array (length m); constraints n,m ≤ 1e5 and numbers[i] ≤ 1e9.
  • Context: fairy light bulbs where visibility flips based on number properties.
  • From Citadel interviews, a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: