--- title: "移动零" created: 2025-11-28 tags: - 算法 --- # 移动零 ## 题目 [移动零](https://leetcode.cn/problems/move-zeroes/) ![[image-755f6a2d.png]] ## 思路分析 快排的思路 不过现在是同方向移动 指针i去找非0数 指针j找0 若j& nums) { int i=0,j=0; int n=nums.size(); while(i& nums) { int snowball=0; for(int i=0;i0) { swap(nums[i],nums[i-snowball]); } } } }; ``` ## 同类题型 ## 视频讲解 --- ⬅️ [[2-Learning/02-算法/03-刷题理模型/双指针相关模型/前后指针/最长连续子序列|最长连续子序列]] 🏠 [[00-刷题理模型]] ➡️ [[翻转单词顺序|翻转单词顺序]]