Practice Find The First Player to win K Games in a Row
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Players with unique values in skills begin in a queue ordered by their original indices. In each game, the first two compete: the higher-skill player wins and stays at the front, while the loser goes to the back. Return the original index of the first player to win k consecutive games.
Source: Find The First Player to win K Games in a Row on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
skills = [4,2,6,3,9], k = 2
Output
2
# Example 2
Input
skills = [2,5,4], k = 3
Output
1
Constraints
n == skills.length
2 <= n <= 10^5
1 <= k <= 10^9
1 <= skills[i] <= 10^6
All integers in skills are unique.
Related LeetCode Problems
Practice more problems similar to Find The First Player to win K Games in a Row.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.