O(1) Solution fast as f*ck
IntuitionApproachCyclic solution
Ecach children has bal: 0,1,2,3...n-1,n-2,...,3,2,1
CycleLen = 2n - 2
You need to take mod from cycle len
If k < n then k is so
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
Cyclic solution
Ecach children has bal: 0,1,2,3...n-1,n-2,...,3,2,1
CycleLen = 2n - 2
You need to take mod from cycle len
If k < n then k is solution otherwise you have to substract k from cycle len.


# Complexity
- Time complexity: O(1)

- Space complexity:
- Time complexity: O(1)

# Code
```golang []
func numberOfChild(n int, k int) int {
    cycleLen := (2 * n  - 2)
    k = k % cycleLen

    if k < n {
        return k
    } else {
        return cycleLen - k
    }
}
```
['Go']