every blog every motto: You will never know unless you try
0. 前言
无
1. 正文
1.1 题目
1.2 题解
python:
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
if not nums:
return nums
j = 0
for i in range(len(nums)):
if nums[i]:
nums[i],nums[j] = nums[j],nums[i]
j+=1