Skip to content

Commit b24bd54

Browse files
refactor 277
1 parent 8ba7a9b commit b24bd54

File tree

1 file changed

+0
-12
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-12
lines changed

src/main/java/com/fishercoder/solutions/_277.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 277. Find the Celebrity
5-
*
6-
* Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity.
7-
* The definition of a celebrity is that all the other n - 1 people know him/her but he/she does not know any of them.
8-
* Now you want to find out who the celebrity is or verify that there is not one.
9-
* The only thing you are allowed to do is to ask questions like: "Hi, A. Do you know B?" to get information of whether A knows B.
10-
* You need to find out the celebrity (or verify there is not one) by asking as few questions as possible (in the asymptotic sense).
11-
* You are given a helper function bool knows(a, b) which tells you whether A knows B. Implement a function int findCelebrity(n), your function should minimize the number of calls to knows.
12-
*
13-
* Note: There will be exactly one celebrity if he/she is in the party. Return the celebrity's label if there is a celebrity in the party. If there is no celebrity, return -1.
14-
*/
153
public class _277 {
164

175
public static class Solution1 {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy