Distinct In Every Window

Programming Interview Hard 5 views
Back to Questions

Problem Description

For each testcase you get n, k and n integers. For each window of size k output how many distinct numbers are inside.

Input Format

First integer t. For each: n k then n ints.

Output Format

t lines window distinct counts.

Sample Test Case

Input:
1 7 4 1 2 1 3 4 2 3
Output:
3 4 4 3

Constraints

Sum of n over all testcases

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next