Given a queue of non-negative integers and an integer k, where all numbers in the queue repeat every k positions, find the number of unique digits in the queue.
Explanation: Since digits repeat every 2 positions, we only need to consider unique digits at positions 0 and 1, which are 1 and 2 respectively.
Explanation: Since all digits are the same, the entire queue has only 1 unique digit.
Find unique element using XOR
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak