Leetcode Algorithms

283. Move Zeroes

Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.

Example:

Note:

  1. You must do this in-place without making a copy of the array.
  2. Minimize the total number of operations.

Solution:

Link

--

--

My homepage to record my thought processes for solving SQL and Algorithm questions

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store