Tag view

#greedy

Cross-subject tag search for related interview cards.

Clear

Results update as you type. Press / to jump straight into search.

Tagged with greedy

2 cards

Coding Exercises Easy O(n)

Majority Element

Track a running candidate and increment or decrement a counter as you scan. When the counter drops to zero, start fresh with the current value as the new candidate.

Return the element that appears more than n // 2 times in an array.