Skip to content

Commit ea8daa4

Browse files
authored
Merge pull request #1451 from ivan1016017/november10
adding algos
2 parents 54d00fb + 7a5d35d commit ea8daa4

20 files changed

Lines changed: 150 additions & 251 deletions

src/my_project/interviews/amazon_high_frequency_23/round_2/two_sum_round_1.py renamed to src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_1.py

File renamed without changes.

src/my_project/interviews/amazon_high_frequency_23/round_2/two_sum_round_6.py renamed to src/my_project/interviews/amazon_high_frequency_23/common_algos/two_sum_round_2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
class Solution:
55
def twoSum(self, nums: List[int], target: int) -> List[int]:
66

7-
answer = dict()
7+
dic_answer = dict()
88

99
for k, v in enumerate(nums):
1010

11-
if v in answer:
12-
return [answer[v], k]
11+
if v in dic_answer:
12+
return [k, dic_answer[v]]
1313
else:
14-
answer[target - v] = k
14+
dic_answer[target - v] = k
1515

1616
return []

src/my_project/interviews/amazon_high_frequency_23/round_2/valid_palindrome_round_1.py renamed to src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_1.py

File renamed without changes.

src/my_project/interviews/amazon_high_frequency_23/round_2/valid_palindrome_round_2.py renamed to src/my_project/interviews/amazon_high_frequency_23/common_algos/valid_palindrome_round_2.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ def isPalindrome(self, s: str) -> bool:
88
# To lowercase
99
s = s.lower()
1010

11-
# Remove non-alphanumerical characters
11+
# Remove non-alphanumeric characters
1212
s = re.sub(pattern='[^a-zA-Z0-9]', repl='', string=s)
1313

14-
# Find if it is palindrome or not
15-
14+
# Determine if it is palindrome or not
1615
len_s = len(s)
1716

1817
for i in range(len_s//2):
19-
18+
2019
if s[i] != s[len_s - 1 - i]:
2120
return False
2221

23-
return True
22+
return True
23+
24+

src/my_project/interviews/amazon_high_frequency_23/round_2/two_sum_round_2.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/my_project/interviews/amazon_high_frequency_23/round_2/two_sum_round_3.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/my_project/interviews/amazon_high_frequency_23/round_2/two_sum_round_4.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/my_project/interviews/amazon_high_frequency_23/round_2/two_sum_round_5.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/my_project/interviews/amazon_high_frequency_23/round_2/valid_palindrom_round_3.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/my_project/interviews/amazon_high_frequency_23/round_2/valid_palindrome_4.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)