From 7fe7c852f5ffad71303b910207cab31d2a8fdd47 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 6 Jun 2026 04:55:50 -0600 Subject: [PATCH] adding updates --- .../common_algos/two_sum_round_6.py | 16 ++++++++++++++ .../common_algos/valid_palindrome_round_6.py | 22 +++++++++++++++++++ .../find_minimum_time_to_finsh_all_jobs_ii.py | 12 ++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_6.py create mode 100644 src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_6.py create mode 100644 src/my_project/interviews/amazon_high_frequency_23/round_6/find_minimum_time_to_finsh_all_jobs_ii.py 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 new file mode 100644 index 00000000..79e2ca43 --- /dev/null +++ b/src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_6.py @@ -0,0 +1,16 @@ +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_6.py b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_6.py new file mode 100644 index 00000000..b9954582 --- /dev/null +++ b/src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_6.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/find_minimum_time_to_finsh_all_jobs_ii.py b/src/my_project/interviews/amazon_high_frequency_23/round_6/find_minimum_time_to_finsh_all_jobs_ii.py new file mode 100644 index 00000000..b6a21243 --- /dev/null +++ b/src/my_project/interviews/amazon_high_frequency_23/round_6/find_minimum_time_to_finsh_all_jobs_ii.py @@ -0,0 +1,12 @@ +from typing import List, Union, Collection, Mapping, Optional +from abc import ABC, abstractmethod +import math + +class Solution: + def minimumTime(self, jobs: List[int], workers: List[int]) -> int: + + jobs.sort() + workers.sort() + + return max([math.ceil((n/d)) for n, d in zip(jobs, workers)]) +