#3175
Find The First Player to win K Games in a Row
expert · 1020 · lc medium +32 · 40.1% accepted · 139 likes · top 19%
Description
In a competition of n players (0 to n - 1) queued in order, players take turns competing: the two at the front face off, the higher-skilled wins and stays at the front while the loser goes to the back. The first player to win k consecutive games is the champion. Return the initial index of that player.
Code
1
2
3