Meta | OA | Number of subarrays
Anonymous User
2841

Find number of contiguous subarrays in an array such that there are atleast k-elements which occur only once in that sub-array.

Eg:

Array: [1, 2, 1, 1]
k: 2

Ans: 2

[1, 2], [2, 1]

[1, 2, 1], [2, 1, 1], [1, 2, 1, 1] shouldn't be counted because only 2 occurs once.

Could come up with only O(n^2) solution.

Comments (4)