FunctionRacerProblemsRace

The One Not Tripled

MediumBitsPython, JavaScript, TypeScript, Java, C++

Every value in nums appears exactly three times, except for one value that appears exactly once. Return that value.

Aim to do it with bit counting and no dictionary: look at one bit position at a time.

Example 1

nums [5,9,5,5]
returns 9

5 appears three times and 9 once.

Example 2

nums [4,4,0,4]
returns 0

The single value can be 0.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Bits problems