FastPrepLight Bulbs Left On After All Engineers Finish
Problems/Light Bulbs Left On After All Engineers Finish

Light Bulbs Left On After All Engineers Finish

Akuna Capital logoAkuna Capital● EasyNEW GRADOA

Updated Dec 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: One report, posted in 2026 about an Akuna Capital online assessment for a full-time new-graduate position in the quant track, names two multiple-choice questions the author had not seen before; this problem is built on one of them.

In that question 100 bulbs are all off at first, and 100 engineers take turns, the k-th engineer toggling every k-th bulb. It asks how many bulbs are on when all of them are done, and the author gives the answer 10.

Our choices: the number of bulbs, which is also the number of engineers, is an input up to 10^9 instead of a fixed 100; you return the count instead of picking one of the offered choices, which the report does not list. The reported case is Example 1; we chose the other examples and the limit.

Our version is about 90% the same as the reported question.

There are n light bulbs, numbered from 1 to n, and all of them start turned off. There are also n engineers, numbered from 1 to n.

Engineer k toggles every k-th light bulb: bulbs k, 2k, 3k, and so on, up to bulb n. Toggling a bulb turns it on if it is off, and off if it is on. So engineer 1 toggles every bulb, engineer 2 toggles every second bulb, engineer 3 toggles every third bulb, and engineer n toggles only bulb n.

After all n engineers finish, return how many light bulbs remain on.

Function

bulbsLeftOn(n: int) → int

Examples

Example 1

n = 100return = 10

Bulb 12 is toggled by engineers 1, 2, 3, 4, 6 and 12, six times, so it ends off. Bulb 36 is toggled by engineers 1, 2, 3, 4, 6, 9, 12, 18 and 36, nine times, so it ends on. After all 100 engineers finish, exactly 10 bulbs are on, so the answer is 10.

Example 2

n = 6return = 2

Bulb 1 is toggled by engineer 1 only: on. Bulb 2 by engineers 1 and 2: off. Bulb 3 by 1 and 3: off. Bulb 4 by 1, 2 and 4: on. Bulb 5 by 1 and 5: off. Bulb 6 by 1, 2, 3 and 6: off. Bulbs 1 and 4 are on, so the answer is 2.

Example 3

n = 16return = 4

Bulb 16 is toggled by engineers 1, 2, 4, 8 and 16, five times, so it ends on. Engineer 16 is the last one to touch it. The bulbs left on are 1, 4, 9 and 16, so the answer is 4.

Constraints

  • 1 <= n <= 10^9

More Akuna Capital Online Assessment questions

  • Last Digit of the Ways to Split Traders Between Two OfficesOA · Seen Dec 2026
  • Delivery Management SystemOA · Seen Nov 2026
  • Count Server ReplacementsOA · Seen Nov 2026
  • Match Orders by Price and Arrival TimeOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Maximum Remaining Drone PowerOA · Seen Nov 2026
  • Rolling MetricsOA · Seen Oct 2026
  • Vowel Substring GameOA · Seen Sep 2026
  • Competitive ForagingOA · Seen Sep 2026
  • Binary CircuitOA · Seen Sep 2026
  • Items SortOA · Seen Sep 2026

Similar questions at other companies

  • Counting Cows by Their LegsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Summarize Taxi Drivers and RidesBoston Consulting Group · OABoston Consulting Group interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Digit-Sum Sequence Join PointOpenAI · OAOpenAI interview questions

Akuna Capital interview experiences

  • Akuna Capital Quant Trader and QR Interviews: 5 Experiences
  • Akuna Capital JQR CodePair Rounds: 8 Experiences (Part 6 of 6)
  • Akuna Capital QR Probability Phones: 14 Experiences (Part 5 of 6)
  • Akuna Capital QR-ML Interviews: 11 Experiences (Part 4 of 6)
  • Akuna Capital QR Regression Rounds: 11 Experiences (Part 3 of 6)
  • Akuna Capital QR Coding Interviews: 17 Experiences (Part 2 of 6)
All Akuna Capital interview questionsSee Akuna Capital hiring insights
Saved
class Solution {
    public int bulbsLeftOn(int n) {
        // Write your code here.
    }
}
Checking account…