Remove elements

This commit is contained in:
2022-11-24 17:21:25 +08:00
parent 56880d0095
commit 1e65cff7e5
6 changed files with 72 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
# 数组
- [二分查找](./bin_search.md)
- [移除元素](./remove_elements.md)
# 经典代码

View File

@@ -0,0 +1,11 @@
# 移除元素
查找数组中的目标元素 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/)