Python 3 || 2 lines, abs  || T/S: 94% / 28%
Here\'s the intuition:\n\n- After 2*n - 2 seconds, the ball is back to child 0, so we only need to be concerned with k%=  2*n -2.\n\n- The graph of f(k) = n-1 -
Here\'s the intuition:\n\n- After `2*n - 2` seconds, the ball is back to *child 0*, so we only need to be concerned with `k%=  2*n -2`.\n\n- The graph of ` f(k) = n-1 - abs(k-n+1)` is in the figure below, for the case in which *n* = 3. If *k* = 5, then *k* % 4 = 1 and *f*(1) = 1.\n\n![graph.jpg](https://assets.leetcode.com/users/images/1a754130-a07a-487f-afbb-04a4af35e9c0_1717946739.3615491.jpeg)\n\n\n\nIt\'s left to the mathematically prepared and motivated reader to verify the following code.\n```\nclass Solution:\n    def numberOfChild(self, n: int, k: int) -> int:\n\n        k%=  2*n -2\n\n        return n-1 - abs(n-1 - k)\n```\nAnd we all know it could be a one-liner, but please don\'t post it here, even though it "might be interesting."\n\n[https://leetcode.com/problems/find-the-child-who-has-the-ball-after-k-seconds/submissions/1282445204/](https://leetcode.com/problems/find-the-child-who-has-the-ball-after-k-seconds/submissions/1282445204/)\n\nI could be wrong, but I think that time complexity is *O*(1) and space complexity is *O*(1).\n\n
['Python3']