ByteByteGo logo
menuProblems List

Shift Zeros to the End

Easy

Given an array of integers, modify the array in place to move all zeros to the end while maintaining the relative order of non-zero elements.

Example:

Input: nums = [0, 1, 0, 3, 2]
Output: [1, 3, 2, 0, 0]

You can practice coding exercises online by logging into bytebytego.com on your laptop.