Count subarrays with ≥k identical pairs | Uber Interview Question