Code Room
CodingMediumcod-g403
Subject Bit manipulationLevel Mid–Senior~25 minCommon in Distributed systems · Algorithms & data structures interviewsIndustries Software development

Question

In an array of integers, exactly two distinct values appear once and every other value appears exactly twice. Return those two single values as a list sorted ascending. Constraints: array length is even and at least 2, values fit in 32-bit signed range, and a constant-space O(n) solution is expected.

Implement
single_number_iii(nums: list[int]) → list[int]
Examples
in[[1,2,1,3,2,5]]out[3,5]
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.