From ee9d079d0b7d24f7b45871998ea5c433bffcc6a4 Mon Sep 17 00:00:00 2001 From: sangge-rockpi <2251250136@qq.com> Date: Fri, 19 Jan 2024 20:37:48 +0800 Subject: [PATCH] update 1 --- leetcode/1.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/leetcode/1.py b/leetcode/1.py index f05e669..f3865de 100644 --- a/leetcode/1.py +++ b/leetcode/1.py @@ -13,9 +13,11 @@ class Solution: if nums[i] == another: temp_list = nums temp_list.pop(i) - if another not in temp_list: + if another in temp_list: answer.append(i) answer.append(temp_list.index(another) + 1) + elif another not in temp_list: + continue answer.append(i) answer.append(nums.index(another)) return answer