Search
⌘K
Get Premium
Leetcode 3636. Threshold Majority Queries
Given an array and many queries [l, r, threshold], return for each query the element in nums[l..r] that appears at least threshold times (choosing the highest-frequency element, and the smallest value on ties), or -1 if none exists. The core challenge is answering many range-frequency/majority queries efficiently, requiring preprocessing to support fast frequency checks within subarrays.
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.