From 563987edea65c357621fedd9be2577154ed16f97 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Jan 2026 04:34:43 -0600 Subject: [PATCH] adding algo --- .../common_algos/two_sum_round_1.py | 2 +- .../common_algos/two_sum_round_2.py | 16 -------------- .../common_algos/two_sum_round_3.py | 16 -------------- .../common_algos/two_sum_round_4.py | 16 -------------- .../common_algos/two_sum_round_5.py | 16 -------------- .../common_algos/two_sum_round_6.py | 16 -------------- .../common_algos/two_sum_round_7.py | 16 -------------- .../common_algos/valid_palindrome_round_1.py | 3 +-- .../common_algos/valid_palindrome_round_2.py | 22 ------------------- .../common_algos/valid_palindrome_round_3.py | 22 ------------------- .../common_algos/valid_palindrome_round_4.py | 22 ------------------- .../common_algos/valid_palindrome_round_5.py | 22 ------------------- .../common_algos/valid_palindrome_round_6.py | 22 ------------------- .../common_algos/valid_palindrome_round_7.py | 22 ------------------- 14 files changed, 2 insertions(+), 231 deletions(-) delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_2.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_3.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_4.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_5.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_6.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_7.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_2.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_3.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_4.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_5.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_6.py delete mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_7.py diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_1.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_1.py index 6c0c6330..534c7ec3 100644 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_1.py +++ b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_1.py @@ -12,5 +12,5 @@ def twoSum(self, nums: List[int], target: int) -> List[int]: return [answer[v], k] else: answer[target - v] = k - + return [] \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_2.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_2.py deleted file mode 100644 index 6c0c6330..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_2.py +++ /dev/null @@ -1,16 +0,0 @@ -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 [] \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_3.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_3.py deleted file mode 100644 index e03fe46f..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_3.py +++ /dev/null @@ -1,16 +0,0 @@ -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 [] \ No newline at end of file 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 deleted file mode 100644 index 6c0c6330..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_4.py +++ /dev/null @@ -1,16 +0,0 @@ -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 [] \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_5.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_5.py deleted file mode 100644 index 6c0c6330..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_5.py +++ /dev/null @@ -1,16 +0,0 @@ -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 [] \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_6.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_6.py deleted file mode 100644 index 6c0c6330..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_6.py +++ /dev/null @@ -1,16 +0,0 @@ -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 [] \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_7.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_7.py deleted file mode 100644 index 6c0c6330..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_7.py +++ /dev/null @@ -1,16 +0,0 @@ -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 [] \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_1.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_1.py index 95709c3e..cad2b1e6 100644 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_1.py +++ b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_1.py @@ -1,4 +1,3 @@ - from typing import List, Union, Collection, Mapping, Optional from abc import ABC, abstractmethod import re @@ -20,4 +19,4 @@ def isPalindrome(self, s: str) -> bool: if s[i] != s[len_s - 1 - i]: return False - return True \ No newline at end of file + return True \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_2.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_2.py deleted file mode 100644 index cad2b1e6..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_2.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import List, Union, Collection, Mapping, Optional -from abc import ABC, abstractmethod -import re - -class Solution: - def isPalindrome(self, s: str) -> bool: - - # To lowercase - s = s.lower() - - # Remove non-alphanumeric characters - s = re.sub(pattern=r'[^a-zA-Z0-9]', repl='', string=s) - - # Determine if s is palindrome or not - len_s = len(s) - - for i in range(len_s//2): - - if s[i] != s[len_s - 1 - i]: - return False - - return True \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_3.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_3.py deleted file mode 100644 index cad2b1e6..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_3.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import List, Union, Collection, Mapping, Optional -from abc import ABC, abstractmethod -import re - -class Solution: - def isPalindrome(self, s: str) -> bool: - - # To lowercase - s = s.lower() - - # Remove non-alphanumeric characters - s = re.sub(pattern=r'[^a-zA-Z0-9]', repl='', string=s) - - # Determine if s is palindrome or not - len_s = len(s) - - for i in range(len_s//2): - - if s[i] != s[len_s - 1 - i]: - return False - - return True \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_4.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_4.py deleted file mode 100644 index a81c8f4b..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_4.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import List, Union, Collection, Mapping, Optional -from abc import ABC, abstractmethod -import re - -class Solution: - def isPalindrome(self, s: str) -> bool: - - # To lowercase - s = s.lower() - - # Remove non-alphanmeric characters - s = re.sub(pattern=r'[^a-zA-Z0-9]', repl='', string=s) - - # Determine if s is palindrome or not - len_s = len(s) - - for i in range(len_s//2): - - if s[i] != s[len_s - 1 - i]: - return False - - return True \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_5.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_5.py deleted file mode 100644 index cad2b1e6..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_5.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import List, Union, Collection, Mapping, Optional -from abc import ABC, abstractmethod -import re - -class Solution: - def isPalindrome(self, s: str) -> bool: - - # To lowercase - s = s.lower() - - # Remove non-alphanumeric characters - s = re.sub(pattern=r'[^a-zA-Z0-9]', repl='', string=s) - - # Determine if s is palindrome or not - len_s = len(s) - - for i in range(len_s//2): - - if s[i] != s[len_s - 1 - i]: - return False - - return True \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_6.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_6.py deleted file mode 100644 index 92795734..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_6.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import List, Union, Collection, Mapping, Optional -from abc import ABC, abstractmethod -import re - -class Solution: - def isPalindrome(self, s: str) -> bool: - - # To lowecase - s = s.lower() - - # Remove non-alphanumeric characters - s = re.sub(pattern=r'[^a-zA-Z0-9]', repl='', string=s) - - # Determine if s is palindrome or not - len_s = len(s) - - for i in range(len_s//2): - - if s[i] != s[len_s - 1 - i]: - return False - - return True \ No newline at end of file diff --git a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_7.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_7.py deleted file mode 100644 index cad2b1e6..00000000 --- a/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_7.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import List, Union, Collection, Mapping, Optional -from abc import ABC, abstractmethod -import re - -class Solution: - def isPalindrome(self, s: str) -> bool: - - # To lowercase - s = s.lower() - - # Remove non-alphanumeric characters - s = re.sub(pattern=r'[^a-zA-Z0-9]', repl='', string=s) - - # Determine if s is palindrome or not - len_s = len(s) - - for i in range(len_s//2): - - if s[i] != s[len_s - 1 - i]: - return False - - return True \ No newline at end of file