Skip to content

Commit f4f44c2

Browse files
committed
two-sum: 역순 인덱스도 검증할 수 있도록 set 사용
1 parent 93273c4 commit f4f44c2

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

two-sum/gyeo-ri.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ def twoSum(self, nums: list[int], target: int) -> list[int]:
1212

1313
if __name__ == "__main__":
1414
test_cases = [
15-
([2, 7, 11, 15], 9, [0, 1]),
16-
([3, 2, 4], 6, [1, 2]),
17-
([3, 3], 6, [0, 1]),
18-
([-2, -3, 0, 3], 1, [0, 3]),
19-
([0, -5, 2, 6], -3, [1, 2]),
20-
([4, 7, 2, 0, 0], 0, [3, 4]),
15+
([2, 7, 11, 15], 9, {0, 1}),
16+
([3, 2, 4], 6, {1, 2}),
17+
([3, 3], 6, {0, 1}),
18+
([-2, -3, 0, 3], 1, {0, 3}),
19+
([0, -5, 2, 6], -3, {1, 2}),
20+
([4, 7, 2, 0, 0], 0, {3, 4}),
2121
]
2222

2323
solution = Solution()
2424
for idx, case_ in enumerate(test_cases):
2525
nums, target, answer = case_
2626
result = solution.twoSum(nums, target)
27-
assert (
28-
answer == result
27+
assert answer == set(
28+
result
2929
), f"Test Case {idx} Failed: Expected {answer}, Got {result}"

0 commit comments

Comments
 (0)