Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Find the Celebrity

Medium Graph Basics

In a party of n people a celebrity is known by everyone but knows nobody. Given the matrix knows[i][j] (1 if i knows j), print the celebrity's index (0-indexed) or -1.

Constraints

2 <= n <= 100

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.