856. Twin Numbers
Given an array of integers nums, where each element occurs thrice, except one which occurs twice. Return the element which repeats twice.
Example 1:
Input: nums = [1, 1, 2, 2, 2, 3, 3, 3]
Output: 1
Explanation: Element with value 1 occurs twice, others occur thrice.
Example 2:
Input: nums = [9, 0, 9, 9, 0]
Output: 0
Explanation: Element with value 0 occurs twice, others occur thrice.
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 2 <= nums.length <= 105
- 0 <= nums[i] <= 104
- There will always be an element that occurs twice.