aboutsummaryrefslogtreecommitdiff
path: root/benchmark/agbenchmark/challenges/deprecated/d2.1_guided/artifacts_in/sample_code.py
blob: df8120bfa2e406955b278914ebebfc7a4592f18a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# 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