FastPrepFind the Damaged Toy
Problems/Find the Damaged Toy

Find the Damaged Toy

Goldman Sachs logoGoldman Sachs● EasyOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

At a birthday party, N kids (IDs from 1 to N) sit in a circle. The host has T toys to distribute, starting from kid with ID D and giving one toy at a time in ascending order. After reaching kid N, the count continues from kid 1.

Input

Three integers:

  1. N: Number of kids
  2. T: Number of toys
  3. D: Starting kid's ID

Output

Print the ID of the kid who receives the damaged (last) toy.

Function

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

Examples

Example 1

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

:)

More Goldman Sachs interview questions

  • Best Average Student ScorePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Hash MapOA · PHONE SCREEN · Seen Nov 2026
  • House Robber IIIPHONE SCREEN · Seen Nov 2026
  • Knight Probability in ChessboardONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · Seen Nov 2026
  • Maximum Ones After K OperationsOA · Seen Nov 2026
  • Palindrome CounterOA · Seen Oct 2026
  • Longest Palindromic SubsequenceOA · Seen Oct 2026
  • Check a Complete Binary TreePHONE SCREEN · Seen Oct 2026
  • Meeting RoomsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
  • Costliest ChocolateRippling · OARippling interview questions
  • Distinct Chapters Missed During a Cyclic AbsenceVisa · OAVisa interview questions
  • Count Palindromic Base RepresentationsSEDEMAC · OA
  • Reduce a Number to One DigitAccenture · OAAccenture interview questions
  • Online No-Intercept Linear RegressionTwo Sigma · OATwo Sigma interview questions
  • Calculate the Half SpreadMillennium · OAMillennium interview questions
  • Plus Mult ArrayIBM · OAIBM interview questions
  • Product Minus Sum of DigitsTikTok · OATikTok interview questions
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
class Solution {
    public int findDamagedToy(int N, int T, int D) {
        // write your code here
    }

}
Checking account…