Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1157. Online Majority Element In Subarray
Preprocess an array to support up to 10^4 queries that ask whether any value appears at least threshold times in a subarray arr[left..right] (returning that value or -1). Key constraint: 2*threshold > right-left+1 (so the target is a strict majority), so the challenge is to enable fast per-query majority detection via compact preprocessing of element positions/frequencies.
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.