values. Call a contiguous non-empty window of the array **full** if it contains every distinct value that occurs anywhere in the array.
Return the number of full windows.values=[4, 9, 4, 4] → 5
There are two distinct values, 4 and 9. Both appear in [4, 9], [4, 9, 4], [4, 9, 4, 4], [9, 4] and [9, 4, 4]: 5 windows.
values=[6, 6, 6] → 6
There is only one value, so each of the 6 non-empty windows qualifies.
values=[1, 2, 3] → 1
values=[4, 9, 4, 4]
5
Run checks the first 3 tests in your browser. Submit checks all 102 tests on the server, hidden ones included.