Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.
Example 1
Input: nums = [1,1,1,3,3,2,2,2]
Output: [1,2]
Explanation: n = 8, so an element must appear more than ⌊8/3⌋ = 2 times. Both 1 and 2 appear 3 times, but 3 appears only twice.
Example 2
Input: nums = [3,2,3]
Output: [3]
Explanation: n = 3, so an element needs more than 1 appearance. 3 appears twice, but 2 appears only once.
Example 3
Input: nums = [1]
Output: [1]
Explanation: The single element appears once, which is more than ⌊1/3⌋ = 0.
At most two values can each appear more than n/3 times. Track two candidates with counts; a third distinct value cancels both. A final pass confirms the real counts.
Run checks all cases above. Submit evaluates all test cases.