From 4516aaab6096e84f5fd7b526a135225c1b862570 Mon Sep 17 00:00:00 2001 From: cherrypicker Date: Thu, 21 Dec 2023 15:36:44 +0800 Subject: [PATCH] =?UTF-8?q?Update0027.=E7=A7=BB=E9=99=A4=E5=85=83=E7=B4=A0?= =?UTF-8?q?=20Go=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加注释、代码格式化 --- problems/0027.移除元素.md | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/problems/0027.移除元素.md b/problems/0027.移除元素.md index 8522e785..dbde3d19 100644 --- a/problems/0027.移除元素.md +++ b/problems/0027.移除元素.md @@ -256,17 +256,24 @@ class Solution: ### Go: ```go +// 快慢指针法 +// 时间复杂度 O(n) +// 空间复杂度 O(1) func removeElement(nums []int, val int) int { - length:=len(nums) - res:=0 - for i:=0;i