Find Arrangement
Reported by candidates from IBM's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
IBM pulled this one in June 2024 and it's a scheduling puzzle that looks simple until you try to code it live. You've got constraints, permutations, and a search space that explodes fast if you're not careful. The trick isn't brute force. It's recognizing this as a constraint satisfaction problem where backtracking with pruning cuts the runtime from factorial to something that actually finishes. StealthCoder can spot the pattern and feed you the skeleton if you freeze mid-interview.
Pattern and pitfall
The problem asks you to arrange items such that each item satisfies a given constraint relative to its position or other items. This is classic backtracking: build a candidate solution incrementally, validate constraints at each step, and backtrack the moment a partial solution violates the rules. The key insight is early pruning. Don't wait until you've placed all items to check validity. Validate as you go. Most candidates either miss the constraint check entirely or implement it after the full permutation is built, which wastes time. The other common trap is overthinking a graph-based solution when a simple recursive backtracking with memoization on the remaining items is faster to code and execute. StealthCoder handles the recursion scaffold and constraint logic so you don't blank on the structure.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Find Arrangement cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as permutation sequence. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass IBM's OA.
IBM reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Arrangement FAQ
Is this asking for all valid arrangements or just one?+
The problem typically asks for a count of all valid arrangements or a single example. Check the exact return type in the problem statement. If it's a count, backtracking still works; you just sum the valid branches instead of returning the first one you find.
What's the constraint check I'm supposed to do?+
Read the problem carefully. It usually defines a rule like 'item A must be placed k positions away from item B' or 'item at position i must satisfy a condition with item at position j'. Encode this as a helper function that returns true/false, then call it before placing each new item.
Should I use recursion or iteration?+
Recursion is cleaner for backtracking. You pass the current permutation (or remaining items) and the current position, recurse to fill the next slot, and pop when you backtrack. Iteration is possible but requires a manual stack and more bookkeeping.
How do I know if my solution is fast enough?+
If the input size is small (under 15 items) and your constraint check is O(1) or O(n), backtracking with pruning should run in milliseconds. If it times out, you're either missing pruning or implementing the constraint check inside the recursion incorrectly.
What if I blank on the constraint logic during the OA?+
That's exactly when StealthCoder helps. It reads the problem statement and generates a constraint validation function you can paste and adapt. You focus on the backtracking skeleton and call the function correctly.