Find the Celebrity
A medium-tier problem at 48% community acceptance, tagged with Two Pointers, Graph, Interactive. Reported in interviews at Toast and 6 others.
Find the Celebrity is a medium-difficulty problem that hits your screen roughly half the time you see it in an OA. Google, LinkedIn, and DoorDash ask it regularly. The trap is obvious: you could brute force it in O(n²) and feel fine, then realize you're timing out on large inputs. The real skill is recognizing that you don't need to check everyone against everyone. If this problem lands in your live assessment and you blank on the two-pointer trick, StealthCoder surfaces a working solution in seconds while the proctor sees nothing.
Companies that ask "Find the Celebrity"
Find the Celebrity is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.
Get StealthCoderThe problem disguises itself as a graph traversal or brute-force validation task, but the winning approach is a disciplined two-pointer elimination pattern. You start at the ends and eliminate candidates who can't possibly be the celebrity based on a single query. Each query rules someone out, so you burn through the candidates in linear time. The cognitive trap is thinking you need to validate everyone as you go. Most candidates get stuck trying to build a graph or run nested loops. The elegant insight is that you can discard half your search space per decision without losing correctness. This is where the Interactive label matters: you're constrained by query count, not just time complexity. When you hit this live and the obvious loop fails, StealthCoder knows the elimination sequence and executes it cleanly.
Pattern tags
You know the problem.
Make sure you actually pass it.
Find the Celebrity recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find the Celebrity interview FAQ
Why is this called Interactive and what does that constraint mean?+
You can't just read all inputs upfront. You query relationships one at a time, and each query costs. The two-pointer trick minimizes queries by eliminating one candidate per check. Brute force queries everyone against everyone, which violates the spirit of the constraint and fails on large n.
Is this still asked at FAANG companies?+
Yes. Google, LinkedIn, and DoorDash report asking it. Acceptance is under 50%, so most candidates either time out or don't know the pattern. It's not a hazing problem, it's a differentiator.
What's the difference between solving it and solving it efficiently?+
Inefficient solution checks every pair: O(n²) time, O(n) queries. The two-pointer solution eliminates one candidate per decision: O(n) time, O(n) queries. On n=10,000, the difference is visible.
How does two pointers apply here when there's no sorted array?+
You don't sort. You use two pointers as a way to pick which candidate to eliminate next. If person A knows person B, A can't be the celebrity, so move one pointer. If A doesn't know B, B can't be the celebrity, so move the other. Repeat until one candidate remains.
What happens if you misunderstand the celebrity definition?+
Common mistake: thinking the celebrity must know themselves or must be known by themselves. Reread the constraints. The celebrity knows nobody and is known by everyone else. One misread ruins your whole approach.
Want the actual problem statement? View "Find the Celebrity" on LeetCode →