• + 1 comment

    Test cases. 1-8 work fine. 9 and 10 are timing out. Any leads to find the issue ?

    My approach :- Populate a deque with entire input. Create a subArray of size m and populate it by polling front of queue. Check unique in the subArray and update maxUnique counter if greater than previous maxUnique. Left Shift each array value by 1 except the last(m-1) and poll the front of deque for 1 element and copy to end of array.(subArray[m-1] = headOfDeque). So I iterate the deque only once. It still times out.