I have been unable to solve the question in this image. the most concerning part is k can be as large as 10^14 which doesn't give much options how to traverse and apply the logic. Please provide me a good approach to solve this↵
↵
↵
There are n participants numbered from 1 to n where the ith participant has potentioal denoted by potential[i]. The potential ofd each player is distinct. Initially, all players stand in a queue in order from the 1st to the nth player. In each game, the first 2 participants of the queue compete and the participant with a higher potentioal wins the game. After each game, the winner remains at the beginnning of the queue and plays with the next person of the queue and the losing player goes to the end of the queue. The game continues until a player wins k consecutive wins.↵
↵
Given the potential of the participants and the deciding factor k, find the potential of the winning player.↵
Example: n=4 and potential=[3,2,1,4] and j=2 the output= 3 (1st player)↵
↵
1<=n<=10^5 (n= number of players)↵
2<=k<=10^14↵
1<=potential[i]<=n
↵
↵
There are n participants numbered from 1 to n where the ith participant has potentioal denoted by potential[i]. The potential ofd each player is distinct. Initially, all players stand in a queue in order from the 1st to the nth player. In each game, the first 2 participants of the queue compete and the participant with a higher potentioal wins the game. After each game, the winner remains at the beginnning of the queue and plays with the next person of the queue and the losing player goes to the end of the queue. The game continues until a player wins k consecutive wins.↵
↵
Given the potential of the participants and the deciding factor k, find the potential of the winning player.↵
Example: n=4 and potential=[3,2,1,4] and j=2 the output= 3 (1st player)↵
↵
1<=n<=10^5 (n= number of players)↵
2<=k<=10^14↵
1<=potential[i]<=n