Practice Maximum Employees to Be Invited to a Meeting
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Maximum Employees to Be Invited to a Meeting
Problem Statement
A company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a large circular table, capable of seating any number of employees. The employees are numbered from 0 to n - 1. Each employee has a favorite person and they will attend the meeting only if they can sit next to their favorite person at the table. The favorite person of an employee is not themself. Given a 0-indexed integer array favorite, where favorite[i] denotes the favorite person of the ith employee, return the maximum number of employees that can be invited to the meeting.
Source: Maximum Employees to Be Invited to a Meeting on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
favorite = [2,2,1,2]
3
# Example 2
favorite = [1,2,0]
3
# Example 3
favorite = [3,0,1,4,1]
4
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Employees to Be Invited to a Meeting.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.