FastPrepGuaranteed Left-and-Right Sock Pair
Problems/Guaranteed Left-and-Right Sock Pair

Guaranteed Left-and-Right Sock Pair

IMC Trading logoIMC Trading● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported oral question gives 12 red, 10 black, 8 green and 6 blue pairs and asks for minimum guaranteed left/right matching draws; its core objective matches the source at about 95%. This practice explicitly states finite without-replacement worst-case drawing, pair compatibility, variable counts and bounds. The report did not request an implementation.

You have socks of several colors. For each color i, there are pairCounts[i] left socks and the same number of right socks.

For this exercise, assume socks are drawn one at a time without replacement in an arbitrary order. A usable pair consists of one left sock and one right sock of the same color. Two socks of the same side do not form a usable pair.

Return the minimum number of draws that guarantees at least one usable pair for every possible drawing order.

The puzzle uses 12 red, 10 black, 8 green and 6 blue pairs. Here the per-color counts are an input. Complete minimumGuaranteedSockDraws(pairCounts) and return a signed 64-bit integer. The total pair count is positive.

Function

minimumGuaranteedSockDraws(pairCounts: int[]) → long

Examples

Example 1

pairCounts = [12,10,8,6]return = 37

A pair-free prefix has at most 36 socks; one more guarantees a match.

Example 2

pairCounts = [1]return = 2

A pair-free prefix has at most 1 sock; one more guarantees a match.

Example 3

pairCounts = [0,2,0,1]return = 4

A pair-free prefix has at most 3 socks; one more guarantees a match.

Constraints

  • For this exercise, assume 1 <= pairCounts.length <= 10^5.
  • 0 <= pairCounts[i] <= 10^6.
  • sum(pairCounts) > 0.
  • Each color has equally many left and right socks; drawing is without replacement.

More IMC Trading Phone Screen questions

  • Election District Budget Allocation AnalysisPHONE SCREEN · Seen Aug 2026
  • Uniform Variables: Smaller Below Larger SquaredPHONE SCREEN · Seen Mar 2026
  • Combination Sum with Unlimited ReusePHONE SCREEN · Seen Dec 2025
  • Valid Range of a Three-Outcome Probability ParameterPHONE SCREEN · Seen Dec 2025
  • Expected Fishing CatchPHONE SCREEN · Seen Dec 2025
  • Count Routes Through a City GridPHONE SCREEN · Seen Nov 2024
  • Expected City Arrival and Return DaysPHONE SCREEN · Seen Nov 2024
  • Stationary City Population SharesPHONE SCREEN · Seen Nov 2024
  • Maximum Falling Path SumPHONE SCREEN · Seen Nov 2024
  • Trading Profit Percentage ChangePHONE SCREEN · Seen Feb 2024

Similar questions at other companies

  • Parking Fee CalculatorBreeze · PHONE SCREEN
  • Merchant Payout Reserve CalculatorStripe · PHONE SCREENStripe interview questions
  • Sqrt(x)LinkedIn · PHONE SCREENLinkedIn interview questions
  • Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Circular Primes Below a LimitAmazon · PHONE SCREEN
  • Palindrome NumberKotak Mahindra Bank · PHONE SCREENKotak Mahindra Bank interview questions
  • Streaming AverageXantium · PHONE SCREEN
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN

IMC Trading interview experiences

  • IMC Trading OA: What It Tests (2026)
  • IMC Trading SWE OA and Video: 18 Experiences (Part 3 of 3)
  • IMC Trading SWE OA Questions: 22 Experiences (Part 2 of 3)
  • IMC SWE New Grad OA and Interviews: 58 Experiences (Part 1 of 3)
All IMC Trading interview questionsSee IMC Trading hiring insights
Saved
class Solution {
    public long minimumGuaranteedSockDraws(int[] pairCounts) {
        // Write your solution here.
    }
}
Checking account…