Single Number III Problem

Single Number III Problem — ExecCode Easy DSA Practice

Solve the Single Number III problem on ExecCode. Free online easy DSA practice in Bit Manipulation. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given an integer array nums in which exactly two elements appear only once and all the other elements appear exactly twice, find the two elements that appear only once. You may return the answer in any order, but the trace below returns them in the order the algorithm discovers them.

Examples

Input nums = [1, 2, 1, 3, 2, 5]; Output [3, 5]. Input nums = [-1, 0]; Output [-1, 0]. Input nums = [4, 1, 4, 2]; Output [1, 2]

Constraints

2 <= nums.length <= 30000 -2^31 <= nums[i] <= 2^31 - 1 Exactly two elements appear once

Practice Single Number III free on ExecCode. Browse DSA problems, topic map, and placement guides.