Problem · Math
Find Last Kid
Learn this problemProblem 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 kidsT- The number of toysD- Random number from where distribution should start
Function
findLastKid(N: int, T: int, D: int) → intExamples
Example 1
N = 5T = 2D = 1return = 2As we will start from 1 and kid getting last toy is 2.