Trains the technique from
LeetCode 1287Element Appearing More Than 25% In Sorted ArrayThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A roster roster of badge numbers is sorted in non-decreasing order. Exactly one badge number takes up more than a quarter of the entries.
Return that badge number.
Example 1
Eight entries mean a badge has to appear more than twice. Only 3 does, with four entries, while the two 2 entries are exactly a quarter and so fall short.
Example 2
Every entry carries the same badge, so it fills the whole roster.
Example 3
Six entries mean a badge needs at least two. Only 4 repeats at all, three times over.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def find_special_integer(roster: list[int]) -> int:public int findSpecialInteger(int[] roster)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.