Scramble String
A hard-tier problem at 42% community acceptance, tagged with String, Dynamic Programming. Reported in interviews at Darwinbox and 4 others.
Scramble String is a hard dynamic programming problem that shows up in Google and Amazon interviews, though it's not the most frequent ask. The acceptance rate sits around 42%, which means it's genuinely tricky. The problem asks if you can transform one string into another by recursively scrambling substrings. Most candidates either brute-force every possible split and timeout, or they freeze when they realize the pattern involves both recursion and overlapping subproblems. If this problem hits your live assessment and you blank on the memoization setup, StealthCoder solves it in seconds invisible to the proctor.
Companies that ask "Scramble String"
Scramble String 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 for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderThe trick is recognizing that you're not just checking if two strings match. You need to try every possible split point of the current string, then recursively check if the left and right pieces can scramble into the left and right pieces of the target, or if they can swap and still work. The naive approach explodes into exponential time because you're revisiting the same subproblems over and over. Memoization using a cache keyed on (s1, s2) pairs kills the redundancy. The gotcha is that the recursive structure itself is deceptive. You'll code it, test on small examples, watch it work, then timeout on the full test set because you forgot to memoize. Even candidates comfortable with recursion and dynamic programming often miss that this specific problem demands a cache. StealthCoder surfaces the memoized solution immediately if you hit a wall during the assessment.
Pattern tags
You know the problem.
Make sure you actually pass it.
Scramble String recycles across companies for a reason. It's hard-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 for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Scramble String interview FAQ
Is Scramble String actually asked at FAANG companies, or is it overhyped?+
Yes, it appears in Google and Amazon interviews, though not in every loop. The 42% acceptance rate tells you it's selective but serious. Companies like Rubrik and Media.net ask it too. If you're interviewing at a top-tier firm, don't skip it, but also know it's not the most common ask.
What's the trick I keep missing?+
You must memoize. Without a cache on (s1, s2) pairs, you're recalculating the same subproblems. The recursive structure is clean, but the exponential blowup is invisible until you run it. Cache first, optimization second.
How does this relate to string DP problems?+
It's a fusion of String matching and Dynamic Programming. Unlike edit distance or pattern matching, you're not comparing character-by-character. You're exploring all possible splits and recursively solving subproblems. That recursive framing is what trips people up.
Can I solve it without recursion?+
Technically yes, but the iterative DP table is harder to construct and reason about. Recursion with memoization is cleaner and clearer. Start there. If you nail the recursive version during prep, the iterative version is a bonus.
How much time should I spend drilling this before the OA?+
If Scramble String is on your target company list, drill it until you code the memoized solution without hesitation. It's hard but solvable. If it's a lower-probability ask, treat it as a second-pass problem after you've locked in the medium-difficulty strings and DP staples.
Want the actual problem statement? View "Scramble String" on LeetCode →