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