Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 3134. Find the Median of the Uniqueness Array
Find the median of the multiset formed by the number of distinct elements in every subarray of nums — i.e., determine the k-th smallest value of distinct(nums[i..j]) over all O(n^2) subarrays. Key insight: the predicate "number of subarrays with ≤ t distinct elements" is monotone and can be computed with a sliding-window frequency map, enabling a binary search over t to locate the median.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.