Object-Oriented Programming · LinkedIn · Medium
Problem: Identify the Celebrity You have n individuals whose labels range from 0 through n - 1. A person qualifies as a celebrity when both of these conditions hold: Every other person knows them. They do not know any other person. The following API is available: It reports whether person a knows person b. Write the following function: The function must return the celebrity's label. If the group contains no celebrity, return -1. Use as few calls to knows as possible.…