Skip to content

Commit 20c75e3

Browse files
Issue in the return of the CelebrityProblem
Since the we are only assuming that the first person is the celebrity while returning first person as output , we should return the only thing that is remained in the stack after the check
1 parent 9d705a5 commit 20c75e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/rampatra/arrays/CelebrityProblem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static int findCelebrity(int[][] peoples) {
7575
}
7676
}
7777

78-
return firstPerson;
78+
return possibleCelebrites.pop();
7979
}
8080

8181
public static void main(String[] args) {

0 commit comments

Comments
 (0)