My LeetCode grinding. Trying to do a problem a day.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

problem.txt 306B

123456789101112
  1. 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.
  2. Example:
  3. Input: [0,1,0,3,12]
  4. Output: [1,3,12,0,0]
  5. Note:
  6. You must do this in-place without making a copy of the array.
  7. Minimize the total number of operations.