2025-08-22 17:53:33 +0000 UTC

Find the Child Who Has the Ball After K Seconds

Code

class Solution:
    def numberOfChild(self, n: int, k: int) -> int:
        circleback = (n - 1) * 2
        k %= circleback
        if k < n:
            return k
        return circleback - k