O(1) solution
Approach\nBased on the quotient we can find the direction and the using the reminder we can find the result.\n\n# Complexity\n- Time complexity:O(1)\n\n- Space 
# Approach\nBased on the quotient we can find the direction and the using the reminder we can find the result.\n\n# Complexity\n- Time complexity:$$O(1)$$\n\n- Space complexity:$$O(1)$$\n\n# Code\n```\npublic class Solution {\n    public int NumberOfChild(int n, int k) {\n        n--;\n        int q=k/n;\n        int r=k%n;\n        if((q&1)==1) //if odd, direction in reverse\n            return n-r;\n        return r;\n    }\n}\n```
['C#']