You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p></p><p><span style="font-size:18px">A celebrity is a person who is known to all but does not know anyone at a party. If you go to a party of N people, find if there is a celebrity in the party or not.<br>
5
+
A square NxN matrix M[][] is used to represent people at the party such that if an element of row i and column j is set to 1 it means ith person knows jth person. Here M[i][i] will always be 0.<br>
6
+
<strong>Note:</strong> Follow 0 based indexing.</span><br>
You don't need to read input or print anything. Complete the function <strong>celebrity()</strong> which takes the matrix M and its size N as input parameters and returns the index of the celebrity. If no such celebrity is present, return -1.</span></p>
34
+
35
+
<p><br>
36
+
<spanstyle="font-size:18px"><strong>Expected Time Complexity:</strong> O(N)<br>
0 commit comments