You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an array of numbers 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.
Example:
Input: [1,2,1,3,2,5]
Output: [3,5]
Runtime: 7 ms, faster than 20.31% of Java online submissions
*/
class Solution {
public int[] singleNumber(int[] nums) {
int[] output = new int[2];
int count = 0;
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();