Problem · Math
Find Last Kid
Given n number of kids, t toys and random number d from where the distribution will start. find the last kid who will get the toy. assume kids are sitting in ascending order and in circular way.
Input:
N- The number of kidsT- The number of toysD- Random number from where distribution should start
Examples
01 · Example 1
N = 5 T = 2 D = 1 return = 2
As we will start from 1 and kid getting last toy is 2.
More Goldman Sachs problems
public int findLastKid(int N, int T, int D) {
// write your code here
}
N5
T2
D1
expected2
sign in to submit