Transform Array by Parity
A easy-tier problem at 90% community acceptance, tagged with Array, Sorting, Counting. Reported in interviews at Infosys and 0 others.
You're staring at an array and need to rearrange it so all even numbers come before all odd numbers. It sounds trivial until you realize the constraint: you need to do it in-place without extra space, and the order within each group matters. This problem shows up in Infosys assessments and tests whether you understand the difference between sorting and partitioning. Most candidates overthink it or reach for a sort when a two-pointer approach solves it cleanly. If this hits your live OA and you blank on the partition pattern, StealthCoder surfaces the working solution in seconds, invisible to the proctor.
Companies that ask "Transform Array by Parity"
Transform Array by Parity 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 thinking 'sort the array' when the problem is actually 'partition the array'. You need to move all evens to the left and all odds to the right while preserving the relative order within each group. A two-pointer technique works: scan from the left for an odd number, scan from the right for an even number, then swap. Keep going until the pointers cross. The naive approach is to use extra arrays or call sort, both of which miss the point. The real skill here is recognizing partitioning, not sorting, and implementing it without burning extra memory. This is an easy problem by difficulty rating, but the acceptance rate of 89.5% suggests some candidates miss the in-place constraint or don't handle the stopping condition correctly. When you encounter array partitioning under time pressure in your assessment, StealthCoder is the hedge for when the pattern doesn't click immediately.
Pattern tags
You know the problem.
Make sure you actually pass it.
Transform Array by Parity recycles across companies for a reason. It's easy-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.
Transform Array by Parity interview FAQ
Is this problem actually easy or is the rating wrong?+
The 89.5% acceptance rate confirms it's genuinely easy. Most candidates who attempt it pass. The trick is recognizing it's a partitioning problem, not a sorting one. If you've seen the two-pointer pattern before, you'll solve it in under five minutes. If you haven't, you might overthink and waste time.
Do I need to preserve order within the even and odd groups?+
The problem statement determines this. Read it carefully. If order preservation is required, two-pointer swap won't work. If it's not required, two-pointer is the standard approach. Most in-place partitioning problems don't require it, but verify before you code.
Why would Infosys ask such an easy problem?+
It's not about difficulty. Infosys uses it to filter for coding fundamentals and in-place algorithm understanding. It's a baseline competency check. You're expected to recognize the pattern and execute cleanly, not to struggle with an 'easy' tag.
Can I just use a sort function?+
Technically yes if the problem doesn't forbid it, but that's not the point. Sorting gives you O(n log n) time and O(1) or O(n) space depending on the sort. Partitioning gives you O(n) time and O(1) space. In an interview, using sort signals you didn't see the intended solution. Go for partitioning.
What if I freeze up on the two-pointer logic during the assessment?+
That's exactly the scenario StealthCoder handles. You read the problem, hit a wall, and StealthCoder reads your screen and surfaces a working two-pointer solution in real time, invisible to the proctor. You paste it, tweak it, and move on.
Want the actual problem statement? View "Transform Array by Parity" on LeetCode →