Throw The Ball

Problem Overview

  • Determine which friend holds the ball after k seconds.
  • Inputs: receiver[1..n] and seconds; output: friend number at time = seconds; constraints n ≤ 1e5, seconds ≤ 1e12.
  • A park game where each second friend i throws to receiver[i], starting with friend 1.
  • A Flexport coding interview question; this problem is from Flexport interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: