Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 911. Online Election
Given a time-ordered stream of votes, preprocess to record the leading candidate after each vote (breaking ties in favor of the most recent vote) and answer queries for the leader at time t by finding the latest vote time ≤ t (e.g., via binary search). The challenge is to maintain the current leader efficiently so many q(t) queries (up to 10^4) can be answered quickly.
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.