Single number III
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.
0:00 of about 25 min
solution.py
InputExpectedGot
[[1,2,1,3,2,5]][3,5]not run yetsample