Available question text
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.
Related questions
Continue with questions that share topics or the same question type.
- Check If a Number Is Majority Element in a Sorted Array
Coding
- Longest Subarray of 1's After Deleting One Element
Coding
- Majority Element
Coding · Array · Boyer–Moore Majority Vote Algorithm · Counting
- Majority Element II
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 1157. Online Majority Element In Subarray
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source