Circular Game Winner Finder In Linear Time
Find winner of circular game: `return ($winner + $k) % $i;` formula used in Solution class finds the winner in linear time with constant space.
1823. Find the Winner of the Circular Game Medium There are n friends that are playing a game. The friends are sitting in a circle and are numbered from 1 to n in clockwise order. More formally, moving clockwise from the ith friend brings you to the (i+1)th friend for 1 <= i < n, and moving clockwise from the nth friend brings you to the 1st friend. The rules of the game are as follows: Start at the 1st friend. Count the next k friends in the clockwise direction including the friend you started at. The counting wraps around the circle and may count some friends more than once. The last friend...
