Swift😎
Math (accepted answer)
**Math (accepted answer)**
```
class Solution {
    func numberOfChild(_ n: Int, _ k: Int) -> Int {
        let (cycle, index) = k.quotientAndRemainder(dividingBy: n-1)
        return cycle.isMultiple(of:2) ? index : n-1-index
    }
}
```
['Swift']