Available question text
Given an array and window size k, return the number of distinct elements in every contiguous subarray of length k. The key challenge is to update unique counts efficiently across overlapping windows (sliding-window with frequency counts) to avoid O(nk) work.
Related questions
Continue with questions that share topics or the same question type.
- Count Distinct Numbers on Board
Coding
- Add Two Numbers
Coding · Linked List · Math · Recursion
- Add Two Numbers II
Coding · Linked List · Math · Stack
- Adding Two Negabinary Numbers
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1852. Distinct Numbers in Each Subarray
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source