← Microsoft questions

Distinct Numbers and Max in Window of Size K

Filed under Microsoft

Given an array of integers and an integer k, find the number of distinct elements and the maximum element for each sliding window of size k moving from left to right.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.