Code Room
CodingMediumcod-g841
Subject Bit manipulationLevel Mid–Senior~20 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Every integer in the input array appears exactly three times except for one element that appears exactly once. Find and return that single element. Use constant extra space (no hash map of counts): for each of the 32 bit positions, sum the bit across all numbers; the bits whose total is not a multiple of 3 belong to the unique element. Assume all values fit in a signed 32-bit range and are non-negative for this variant.

Implement
single_number_iii(nums: list[int]) → int
Examples
in[[2,2,3,2]]out3
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.