Minimum Numeric Code Transformation
Reported by candidates from Adobe's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Adobe reported this one in August 2026, and the detail that matters is the Mirror move: 120 becomes 21, leading zero dropped, one step. This is a shortest-path problem in disguise. You get a number x, a target y, and five operations that each cost one step. Values stay between 1 and 10^6. If you've got an OA invite for Adobe, expect to spot BFS fast or lose time. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but the pattern is simple once you see it.
The problem
You receive one reconfiguration request. Start with the positive integer x and transform it into y. Each allowed operation costs exactly one step: Scale: choose an integer a with 2 <= a <= k and replace the current value v with v * a, only when the result is at most 10^6. Split: choose an integer a with 2 <= a <= k. If v is divisible by a, replace it with v / a. Mirror: reverse the decimal digits. Leading zeros produced by reversal are discarded, so 120 becomes 21. Rotate last to front: move the final decimal digit to the front. This operation is forbidden when it would create a leading zero. Swap adjacent digits: swap any one adjacent pair. This operation is forbidden when it would create a leading zero. Every intermediate value must remain between 1 and 10^6, inclusive. Return the minimum number of operations needed to reach y, or -1 when no valid sequence exists. Function minimumCodeTransformOperations(x: int, y: int, k: int) → int Examples Example 1 x = 4 y = 6 k = 3 return = 2 Scale by 3 to get 12, then split by 2 to get 6. No one-step operation transforms 4 directly into 6. Example 2 x = 120 y = 21 k = 10 return = 1 One mirror operation reverses 120 to 021; the leading zero is discarded, leaving 21. Constraints 1 <= x, y <= 10^6 2 <= k <= 10^3
Reported by candidates. Source: FastPrep
Pattern and pitfall
Treat every integer from 1 to 10^6 as a node and every operation as an unweighted edge. That makes it breadth-first search from x, stopping when you pop y. Keep a visited array of size 10^6+1 so each value is expanded once. Per node you generate up to about 2k scale and split neighbors, plus mirror, rotate and up to 6 adjacent swaps. The pitfalls are all in the rules. Scale only counts if the result is at most 10^6. Split needs divisibility. Rotate and swap are banned when they'd create a leading zero, so check the first digit of the new string. Mirror is always allowed and just drops zeros. Convert to a digit string, mutate, convert back. If x equals y, return 0. If the queue empties, return -1. If you freeze on the live OA, StealthCoder is the hedge that hands you the BFS skeleton.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Minimum Numeric Code Transformation 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Adobe's OA.
Adobe reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Numeric Code Transformation FAQ
What's the trick in Minimum Numeric Code Transformation?+
Model it as a graph. Each number is a node, each operation is an edge of cost one, so the minimum steps is plain BFS from x to y. No Dijkstra needed because every edge weighs the same. A visited array over 1 to 10^6 keeps it fast.
How hard is this Adobe OA question really?+
Medium. The algorithm is textbook BFS. The difficulty is in the details: leading-zero rules for rotate and swap, the 10^6 cap on scale, and divisibility on split. Get those edge cases right and it's quick to code.
How do I handle leading zeros correctly?+
Mirror discards leading zeros, so reversing the string and converting to int handles it. Rotate and swap are forbidden if the resulting string starts with 0, so skip those neighbors. Check the first character of the new string before you enqueue anything.
What about time and memory with k up to 1000?+
Each node tries scale and split for a from 2 to k, so roughly 2000 transitions at most, plus a handful of digit moves. Visited-pruning means each of the 10^6 values is expanded once. Split only fires on divisors, and scale is cut off by the cap, so real work is much lower.
How do I prepare for this in 48 hours?+
Write one BFS over an implicit graph from scratch, with a queue, a visited array and a neighbor generator. Then practice digit-string manipulation helpers for reverse, rotate and swap. Test x equals y and the unreachable case returning -1.