FastPrepFastPrep
Problem Brief

Find Last Kid

OA

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 kids
  • T - The number of toys
  • D - Random number from where distribution should start

1Example 1

Input
N = 5, T = 2, D = 1
Output
2
Explanation

As we will start from 1 and kid getting last toy is 2.

public int findLastKid(int N, int T, int D) {
  // write your code here
}
Input

N

5

T

2

D

1

Output

2

Sign in to submit your solution.