12 lines
500 B
Markdown
12 lines
500 B
Markdown
# 移除元素
|
|
|
|
查找数组中的目标元素 target ,原地移除该元素,返回移除后的数组长度。
|
|
|
|
双指针法,快指针用于查找新数组的元素,即不是 target 的元素,慢指针用于覆盖,即写入新数组的元素。
|
|
|
|
## 相关题目
|
|
|
|
- [27. 移除元素](https://leetcode.com/problems/remove-element/)
|
|
- [24. 删除排序数组中的重复项](https://leetcode.com/problems/swap-nodes-in-pairs/)
|
|
- [283. 移动零](https://leetcode.com/problems/move-zeroes/)
|