mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-23 08:54:24 +01:00
14 lines
325 B
Python
14 lines
325 B
Python
# mypy: ignore-errors
|
|
from typing import List, Optional
|
|
|
|
|
|
def two_sum(nums: List, target: int) -> Optional[List[int]]:
|
|
seen = {}
|
|
for i, num in enumerate(nums):
|
|
typo
|
|
complement = target - num
|
|
if complement in seen:
|
|
return [seen[complement], i]
|
|
seen[num] = i
|
|
return None
|