aboutsummaryrefslogtreecommitdiff
path: root/benchmark/agbenchmark/challenges/deprecated/code/d2.1_guided/artifacts_out/sample_code.py
blob: 8b8a8e2ba2319fd52617167493f7bfd50df3fb3b (plain)
1
2
3
4
5
6
7
8
9
10
11
from typing import List, Optional


def two_sum(nums: List, target: int) -> Optional[List[int]]:
    seen = {}
    for i, num in enumerate(nums):
        complement = target - num
        if complement in seen:
            return [seen[complement], i]
        seen[num] = i
    return None