Company: Goldman sachs_27july
Difficulty: medium
Birthday party and return gift Problem Description A birthday party was attended by N number of kids and each kid was given a unique id ranging from 1 to N. As a return gift, there are T toys that must be given to the kids. The party host decides the best way to do this is by sitting the kids down in a circle (ordered by ascending id), and then, starting with a random number D (between 1 and N) and distribute one toy at a time to each sequentially numbered kid, until all toys are distributed. For example, if the host picks a random number (D) 2, then gift distribution order would be (2, 3, 4, 5... N-1, N, 1, 2, 3, 4...) until all T toys are distributed. But the very last toy is damaged. The task is to find and display the ID number of the last kid, who will receive the damaged toy, so that kid can be informed about the same and ask him to go and exchange the toy from the shop. You are required to complete the function findDamagedToy . The function is expected to return an INTEGER . The