LeetCode 277. Find the Celebrity
Given n people labeled 0 to n-1 and an API knows(a, b) that returns true if person a knows person b, find the celebrity — someone who is known by everyone else but knows no one — or return -1 if none exists. The core challenge is to identify the candidate with minimal knows() calls (typically via pairwise elimination) and then verify incoming/outgoing relationships, achieving O(n) time and O(1) space.
Asked at:
HubSpot
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early March, 2026
Junior
Early March, 2026
HubSpot
Senior
Slightly different variation, but the core problem was the same
Late February, 2026
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.