Problem · Math

Find Last Kid

Learn this problem
EasyGoldman Sachs logoGoldman SachsOA

Problem statement

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

Function

findLastKid(N: int, T: int, D: int) → int

Examples

Example 1

N = 5T = 2D = 1return = 2

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

More Goldman Sachs problems

drafts saved locally
public int findLastKid(int N, int T, int D) {
  // write your code here
}
N5
T2
D1
expected2
checking account