Permutations III
A medium-tier problem at 86% community acceptance, tagged with Array, Backtracking. Reported in interviews at Goldman Sachs and 0 others.
Permutations III hits your OA and you've got seconds to lock in the solution. Goldman Sachs has asked this one. It's a medium-difficulty backtracking problem that looks straightforward until you start coding and realize your recursion isn't cleanly separating state from choices. You know permutations exist, you know you need to explore all paths, but the trick is structuring the backtracking loop so you don't duplicate work or leave garbage state behind. An 85% acceptance rate tells you most people who sit down with it pass, which also means the pattern is learnable and testable. If you blank on the exact backtracking skeleton during the assessment, StealthCoder surfaces a working solution invisible to the proctor in seconds.
Companies that ask "Permutations III"
Permutations III 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. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.
Get StealthCoderPermutations III is backtracking on an array where you generate all ordered subsets or rearrangements. The trap is forgetting to track which elements you've already used in the current path, or mutating your input and not restoring it. The standard move is a recursive helper that takes the current permutation being built, a set or boolean array of used indices, and the target array. At each step, you loop through all elements, skip the ones already in the path, add the next one, recurse, then remove it (backtrack). The acceptance rate is high because the pattern is mechanical once you see it, but many candidates second-guess the state management or write inefficient visited checks. During the live OA, if the structure of the recursion isn't clicking, StealthCoder runs invisibly and gives you the exact backtracking template you need to move on.
Pattern tags
You know the problem.
Make sure you actually pass it.
Permutations III 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. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Permutations III interview FAQ
Is Permutations III still asked at Goldman Sachs?+
Yes, Goldman Sachs is confirmed in the problem's company list. Backtracking problems remain popular in their assessment loop because they test algorithmic thinking and state management under pressure. The 85% acceptance rate suggests it's a known pattern, so drilling it before the OA pays off.
What's the main gotcha that tanks people on this problem?+
Forgetting to track or restore state during backtracking. Candidates either don't mark an element as used before recursing, or forget to unmark it when backtracking, leading to duplicates or logic errors. The second common mistake is mutating the input array directly without resetting it between recursive calls.
How does Permutations III relate to other backtracking problems?+
It's the foundation for combinations, subsets, and n-queens style problems. The core insight, recursively explore all choices, commit state, recurse, undo state, appears everywhere. If you nail the backtracking skeleton here, you'll recognize the pattern in harder variants.
Can I solve Permutations III iteratively instead of recursively?+
Technically yes, but the recursive approach is what interviewers expect and is cleaner for permutations. An iterative swap-based approach exists but is trickier to code correctly under time pressure. Stick with recursion for the live OA.
What time and space complexity should I target?+
Time is O(n * n!) because there are n! permutations and each takes O(n) to build. Space is O(n) for the recursion depth plus storage for the result. Those numbers are fixed by the problem itself, so nail the backtracking logic first and the complexity will follow.
Want the actual problem statement? View "Permutations III" on LeetCode →