From 873257dcd812b1d190f9decbf0fed64761d23933 Mon Sep 17 00:00:00 2001 From: Liu Yongliang <41845017+tlylt@users.noreply.github.com> Date: Sat, 8 Jul 2023 07:25:59 +0800 Subject: [PATCH] =?UTF-8?q?Update=200001.=E4=B8=A4=E6=95=B0=E4=B9=8B?= =?UTF-8?q?=E5=92=8C.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix Python solution comment --- problems/0001.两数之和.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0001.两数之和.md b/problems/0001.两数之和.md index ca62e3ed..438fa352 100644 --- a/problems/0001.两数之和.md +++ b/problems/0001.两数之和.md @@ -160,7 +160,7 @@ class Solution: for index, value in enumerate(nums): if target - value in records: # 遍历当前元素,并在map中寻找是否有匹配的key return [records[target- value], index] - records[value] = index # 遍历当前元素,并在map中寻找是否有匹配的key + records[value] = index # 如果没找到匹配对,就把访问过的元素和下标加入到map中 return [] ``` (版本二)使用集合