FastPrepMinimum Nonreciprocal Bandits
Problems/Minimum Nonreciprocal Bandits

Minimum Nonreciprocal Bandits

IMC Trading logoIMC Trading● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an IMC Trading new grad online assessment. The goal is the smallest count, with no pair of bandits that point at each other. It is about 95% the same as the reported two-target puzzle. We made the target count a positive number you can change, and set limits. Those are our choices.

Every bandit must aim at exactly targetsPerBandit distinct other bandits. A bandit cannot aim at itself, and no pair may aim at each other.

Find the minimum number of participating bandits for which this is possible. For this exercise, assume the two-target case in the first example is generalized to the supplied positive target count, with an exact integer result. You only return the minimum count; you do not output a targeting arrangement.

Complete minimumBandits(targetsPerBandit).

Function

minimumBandits(targetsPerBandit: int) → int

Examples

Example 1

targetsPerBandit = 2return = 5

The two-target case needs five bandits. Arrange them in a cycle and let each aim at the next two; no pair aims at each other.

Example 2

targetsPerBandit = 1return = 3

Three bandits can form one directed cycle. Two bandits would have to aim at each other.

Example 3

targetsPerBandit = 3return = 7

In a cycle of seven, each bandit aims at the next three. The reverse offsets are four through six, so no reciprocal pair occurs.

Constraints

  • For this exercise, assume 1 <= targetsPerBandit <= 1000000000.
  • All required targets are distinct and different from the aiming bandit.
  • The returned minimum fits a signed 32-bit integer.

More IMC Trading Online Assessment questions

  • Earliest Meeting Start on a 24-Hour ClockOA · Seen Nov 2026
  • Grid Paths with Override PassesOA · Seen Oct 2026
  • Weighted LFU CacheOA · Seen Sep 2026
  • Rock JumpingOA · Seen Aug 2026
  • Stack Batch RemovalOA · Seen Aug 2026
  • Chain of CommandOA · Seen Aug 2026
  • Choose ContainersOA · Seen Aug 2026
  • Sub-matrix SumsOA · Seen Jul 2026
  • Sub-matrix SumsOA · Seen Jul 2026
  • Can Every Package Fit in a BoxOA · Seen Jul 2026

Similar questions at other companies

  • Drawing EdgeWeRide · OAWeRide interview questions
  • Drawing EdgeIBM · OAIBM interview questions
  • Drawing EdgeSnowflake · OASnowflake interview questions
  • Connected Components with Divisor ThresholdInMobi · OAInMobi interview questions
  • Minimum Numeric Code TransformationAdobe · OAAdobe interview questions
  • Profitable Currency Exchange CycleOptiver · OAOptiver interview questions
  • Can Sort Permutation in Given MovesAmazon · OA
  • Minimum Number of Permutation Operations 👑Geneva Trading · OA
  • Relative Score Graph ComponentsScale AI · OAScale AI interview questions
  • Count OperationsWells Fargo · OAWells Fargo interview questions

Interview reports that mention this question

  • IMC Trading OA: What It Tests (2026)

IMC Trading interview experiences

  • 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 int minimumBandits(int targetsPerBandit) {
        // Write your solution here.
    }
}
Checking account…