An array of numbers: the ith person throws the ball to a[i] every second. At time t, where will the ball be?
Asked in the Tech interview round 1 stage.
Write a function that returns the index of the person holding the ball after exactly t seconds, starting from person start. The ball moves once per second, and at each second the current holder throws it to a[current].
def ball_position(a, start, t):
a: list of integers, where a[i] is the next person index for person istart: integer, the starting holder indext: non-negative integer, number of secondst throws.def ball_position(a, start, t):