As reported: Deutsche Bank Associate Java Backend Developer (3 YOE), L1 technical round on Teams (2025): given an array of positive integers and zeros, push the zeros to the back and the positive numbers to the front, keeping their order, by modifying the same array.
Given an integer array nums, move all 0s to the end while keeping the relative order of the non-zero elements. Do it in place, without making a copy of the array.
This is LeetCode 283 — Move Zeroes.
Example 1
nums = [0,1,0,3,12] -> [1,3,12,0,0]
Example 2
nums = [0] -> [0]
Constraints: 1 ≤ nums.length ≤ 10^4; -2^31 ≤ nums[i] ≤ 2^31 − 1.
Code runner format: one line: nums as a JSON array. Implement moveZeroes(nums) so it changes nums in place and returns nothing; the harness prints nums afterwards.