Search
⌘K

Leetcode 1538. Guess the Majority in a Hidden Array

Given a hidden array accessible only via a query API (e.g., compare elements or check equality), determine whether a value appears more than n/2 times and return an index of that majority element (or -1 if none). The core challenge is to infer the majority with limited queries efficiently using majority-vote style elimination and counting.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.