Maximum Digits with Unique Pairwise Sums

Largest number with unique digit sums is a medium quant interview question on Brain Teasers, reported to have been seen at Optiver.

Difficulty Medium Topic Brain Teasers Reported at Optiver

MyQuantPartner is not affiliated with, endorsed by, or sponsored by these companies, and all trademarks belong to their respective owners.

This brain teaser is about structuring a sequence of digits so that every interaction between two positions behaves differently from every other. It lives at the intersection of discrete math, combinatorics, and number constraints, so it is ideal for quant prep candidates who enjoy pattern-heavy puzzles with a hard upper limit hidden in the rules. It forces you to think of a number not as a value, but as a small combinatorial system.

It trains your intuition for combinatorial explosion, pigeonhole-type limits, and how constraints scale as a set grows. You practice turning a verbal puzzle into counts of possibilities, then reasoning about when a structure can exist at all. This is precisely the kind of abstraction and constraint balancing that good quant interviews probe.

For quant interviews, this matters because trading, risk, and systematic strategy design often involve many interacting variables whose pairwise or higher-order relationships must be understood and controlled. Interviewers use such questions to see if you can reason cleanly about scaling behaviour, feasibility, and edge cases under tight constraints. Strong performance on this style of quant prep problem signals that you can quickly model complex rule-based systems, anticipate collisions or bottlenecks, and argue convincingly about maximums and limits without brute force.

What it tests

This problem class is governed by combinatorial constraints on pairwise interactions within a set of elements—here, the digits of a number. When each pairwise sum must be unique, the set of possible pairs grows quadratically with the number of elements ($n(n-1)/2$), but the set of possible sums is limited by the range of values each element can take. As the set grows, the pigeonhole principle ensures that, beyond a certain point, some pairwise sums must repeat because there are not enough distinct sum values to accommodate all pairs. The core insight is that maximizing the size of such a set requires balancing the range and distribution of its elements to avoid collisions in their pairwise combinations, and that the growth of required distinct outcomes quickly outpaces the available possibilities.

Practise this question with written feedback, or hear it in a spoken mock interview.

Get started free