Skip to content

Commit 55d0ecf

Browse files
authored
Create Find the Child Who Has the Ball After K Seconds.java
1 parent 91e35a8 commit 55d0ecf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution {
2+
public int numberOfChild(int n, int k) {
3+
int factor = k / (n - 1);
4+
int remainder = k % (n - 1);
5+
return factor % 2 == 0 ? remainder : n - 1 - remainder;
6+
}
7+
}

0 commit comments

Comments
 (0)