Easy Python beats 100% - 5 lines only
Intuition\nThere is no need for traversing the array. If k is equal to or less than n, its clear that we will end up on child k.\n\nOnce k hits n and the ball s
# Intuition\nThere is no need for traversing the array. If k is equal to or less than n, its clear that we will end up on child k.\n\nOnce k hits n and the ball starts going backwards, the child that ends up with the ball is child number (n-1) - (k % (n-1)). This is because we count backwards from the last child (child n -1) the number of steps that we have taken since hitting the end of the line. \n\n# Approach\n\ntimes_traversed indicates the number of tims we have fully traversed the line. If times_traversed % 2 == 0 this means we have done one full cycle of the line (there and back once), and are at child 0 or greater. In this case we can calculate the child who receives the ball as child number k % (n-1).\n\nIf times_traversed % 2 is not 0, it means we have traversed the line an odd number of times (for example 3 times). This means we are either at child n, or are going backwards. Therefore we calculate the child with the ball as child number (n-1) - (k % (n-1)).\n\n# Complexity\n- Time complexity is O(1)\n- Space complexity is also O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python []\nclass Solution(object):\n    def numberOfChild(self, n, k):\n        """\n        :type n: int\n        :type k: int\n        :rtype: int\n        """\n  \n        times_traversed = k // (n-1)\n\n        #this means we are going forwards \n        if(times_traversed % 2 == 0):\n            return k % (n-1)\n        # this means we were going backwards\n        else:\n            return (n-1) - k % (n-1)\n        \n\n        \n```
['Python']