From 403afc726e5aab714c6e97da08de4f1dc9ca2230 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 5 Sep 2026 04:48:02 -0600 Subject: [PATCH] adding updates --- .../common_algos/two_sum_round_4.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_4.py diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_4.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_4.py new file mode 100644 index 00000000..d5cc7cd1 --- /dev/null +++ b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_4.py @@ -0,0 +1,18 @@ +from typing import List, Union, Collection, Mapping, Optional +from abc import ABC, abstractmethod + +class Solution: + def twoSum(self, nums: List[int], target: int) -> List[int]: + + answer = dict() + + for k, v in enumerate(nums): + + if v in answer: + return [answer[v], k] + else: + answer[target - v] = k + + return [] + +