From e8848e240b9325abb16c01ee2b8fd643ba02548c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Jun 2026 05:06:57 -0600 Subject: [PATCH 1/2] adding udpates --- .../common_algos/two_sum_round_4.py | 19 ++++++++++++++++ .../common_algos/valid_palindrome_round_4.py | 22 +++++++++++++++++++ ...kids_with_the_greates_number_of_candies.py | 12 ++++++++++ 3 files changed, 53 insertions(+) create mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_4.py create mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_4.py create mode 100644 src/my_project/interviews/amazon_high_frequency_23/round_6/kids_with_the_greates_number_of_candies.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..596113de --- /dev/null +++ b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_4.py @@ -0,0 +1,19 @@ +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 [] + + + 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 new file mode 100644 index 00000000..d07f3a55 --- /dev/null +++ b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_4.py @@ -0,0 +1,22 @@ +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/round_6/kids_with_the_greates_number_of_candies.py b/src/my_project/interviews/amazon_high_frequency_23/round_6/kids_with_the_greates_number_of_candies.py new file mode 100644 index 00000000..1181c33b --- /dev/null +++ b/src/my_project/interviews/amazon_high_frequency_23/round_6/kids_with_the_greates_number_of_candies.py @@ -0,0 +1,12 @@ +from typing import List, Union, Collection, Mapping, Optional +from abc import ABC, abstractmethod + +class Solution: + def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]: + max_candies = max(candies) + return [c + extraCandies >= max_candies for c in candies] + + + + + From ebb422ec667cc234c4b99363750e786fed9ece61 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Jun 2026 05:08:02 -0600 Subject: [PATCH 2/2] adding updates --- .../round_6/kids_with_the_greates_number_of_candies.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/my_project/interviews/amazon_high_frequency_23/round_6/kids_with_the_greates_number_of_candies.py b/src/my_project/interviews/amazon_high_frequency_23/round_6/kids_with_the_greates_number_of_candies.py index 1181c33b..10c4e537 100644 --- a/src/my_project/interviews/amazon_high_frequency_23/round_6/kids_with_the_greates_number_of_candies.py +++ b/src/my_project/interviews/amazon_high_frequency_23/round_6/kids_with_the_greates_number_of_candies.py @@ -2,7 +2,8 @@ from abc import ABC, abstractmethod class Solution: - def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]: + def kidsWithCandies(self, candies: List[int], + extraCandies: int) -> List[bool]: max_candies = max(candies) return [c + extraCandies >= max_candies for c in candies]