Tap here to switch tabs
Problem
Submissions

Problem: Once Twice

Once Twice identifies two exceptional values in an integer array: one appears once and the other twice, while every remaining value appears three times. Return them in that order.

Statement

Given an integer array nums, every element appears exactly 33 times except for 11 element that appears once and 11 element that appears twice.

Return an array containing the element that appears once followed by the element that appears twice.

Constraints:

  • 3≤3 \leq nums.length ≤105\leq 10^5

  • −231≤-2^{31} \leq nums[i] ≤231−1\leq 2^{31} - 1

  • nums.length is a multiple of 33

  • Exactly 11 element appears once, 11 element appears twice, and all other elements appear 33 times

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Once Twice

Once Twice identifies two exceptional values in an integer array: one appears once and the other twice, while every remaining value appears three times. Return them in that order.

Statement

Given an integer array nums, every element appears exactly 33 times except for 11 element that appears once and 11 element that appears twice.

Return an array containing the element that appears once followed by the element that appears twice.

Constraints:

  • 3≤3 \leq nums.length ≤105\leq 10^5

  • −231≤-2^{31} \leq nums[i] ≤231−1\leq 2^{31} - 1

  • nums.length is a multiple of 33

  • Exactly 11 element appears once, 11 element appears twice, and all other elements appear 33 times