Factor Combinations
A medium-tier problem at 50% community acceptance, tagged with Backtracking. Reported in interviews at LinkedIn and 0 others.
Factor Combinations is a medium-difficulty backtracking problem that LinkedIn asks in online assessments. You're given a number n and asked to find all unique combinations of factors greater than 1 that multiply to n. It looks simple until you realize the constraint: factors in each combination must be in increasing order, and you can't repeat the same set. The acceptance rate sits around 50%, which means half the candidates either time out or return duplicates. This is a classic backtracking problem where the obvious greedy or brute-force approach leaves you short.
Companies that ask "Factor Combinations"
Factor Combinations is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.
Get StealthCoderThe trap is iterating from 2 to n and trying every divisor. That gets exponential fast and generates duplicates if you're not careful about ordering. The real pattern: use backtracking with a start index. Once you pick a factor, only search for the next factors from that factor onward. This guarantees increasing order and kills duplicates. The base case is when your remaining product equals 1, at which point you've found a valid combination. Prune branches where the factor is larger than the remaining number. Most candidates either skip the start-index optimization and blow up on time, or they nail the logic but forget to reset state between recursive calls. If this problem hits your live OA and the backtracking ordering confuses you, StealthCoder surfaces the working solution in seconds, invisible to the proctor.
Pattern tags
You know the problem.
Make sure you actually pass it.
Factor Combinations recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Factor Combinations interview FAQ
Is this just brute-force division?+
No. Brute-force generates duplicates and times out on larger inputs. You need backtracking with a start index so you only explore factors in increasing order, pruning branches where the factor exceeds the remaining product. The constraint is the key.
How do I avoid duplicate combinations?+
Start each recursive call from the current factor onward, not from 2. This guarantees every combination is in increasing order and appears exactly once. If you restart from 2 each time, you'll get [2, 3] and [3, 2] as separate results.
What's the time complexity?+
It depends on the input, but worst case is roughly exponential in the number of unique prime factors. For practical OA sizes (n up to a few hundred), backtracking with pruning handles it fine. The trick is the pruning, not the algorithm.
LinkedIn asks this. How often does it come up?+
LinkedIn is the only reported company in the data. Medium difficulty suggests it's a mid-level assessment problem, likely for senior IC or engineering manager roles. It's not a gimmick question; it's core backtracking.
What's the most common mistake?+
Forgetting to pass the updated start index in the recursive call, or restarting from 2 each time. Also, not pruning when the current factor is already larger than the remaining product. These blow up runtime or generate wrong results.
Want the actual problem statement? View "Factor Combinations" on LeetCode →