diff --git a/best-time-to-buy-and-sell-stock/Bumsu-Yi.py b/best-time-to-buy-and-sell-stock/Bumsu-Yi.py new file mode 100644 index 000000000..da2b71ea0 --- /dev/null +++ b/best-time-to-buy-and-sell-stock/Bumsu-Yi.py @@ -0,0 +1,3 @@ +""" +https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ +""" diff --git a/contains-duplicate/Bumsu-Yi.py b/contains-duplicate/Bumsu-Yi.py new file mode 100644 index 000000000..56d6416dc --- /dev/null +++ b/contains-duplicate/Bumsu-Yi.py @@ -0,0 +1,3 @@ +""" +https://leetcode.com/problems/contains-duplicate/ +""" diff --git a/sam_lee/Contains_Duplicate.py b/sam_lee/Contains_Duplicate.py deleted file mode 100644 index 0ac7e3aee..000000000 --- a/sam_lee/Contains_Duplicate.py +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def containsDuplicate(self, nums: List[int]) -> bool: - my_dict = {} - - for num in nums: - if num in my_dict: - return True - my_dict[num] = 0 - - return False \ No newline at end of file diff --git a/sam_lee/Group_Anagrams.py b/sam_lee/Group_Anagrams.py deleted file mode 100644 index cb9a3f7cb..000000000 --- a/sam_lee/Group_Anagrams.py +++ /dev/null @@ -1,12 +0,0 @@ -from collections import defaultdict - -class Solution: - def groupAnagrams(self, strs: List[str]) -> List[List[str]]: - anagrams = defaultdict(list) - - for word in strs: - anagrams[str(sorted(word))].append(word) - - return anagrams.values() - - \ No newline at end of file diff --git a/sam_lee/Two_Sum b/sam_lee/Two_Sum deleted file mode 100644 index d2be88998..000000000 --- a/sam_lee/Two_Sum +++ /dev/null @@ -1,10 +0,0 @@ -class Solution: - def twoSum(self, nums: List[int], target: int) -> List[int]: - my_dict = {} - - for i in range(len(nums)): - complement = target - nums[i] - if complement in my_dict: - return [my_dict[complement], i] - - my_dict[nums[i]] = i \ No newline at end of file diff --git a/sam_lee/Valid_Anagram b/sam_lee/Valid_Anagram deleted file mode 100644 index 8f4adf175..000000000 --- a/sam_lee/Valid_Anagram +++ /dev/null @@ -1,18 +0,0 @@ -# Time Complexity : O(nlog(n)) -# Space Complexity : 0(1) -class Solution: - def isAnagram(self, s: str, t: str) -> bool: - return sorted(s) == sorted(t) - -class Solution: - def isAnagram(self, s: str, t: str) -> bool: - my_dict1 = {} - my_dict2 = {} - - for char in s: - my_dict1[char] = my_dict1.get(char, 0) + 1 - - for char in t: - my_dict2[char] = my_dict2.get(char, 0) + 1 - - return my_dict1 == my_dict2 \ No newline at end of file diff --git a/two-sum/Bumsu-Yi.py b/two-sum/Bumsu-Yi.py new file mode 100644 index 000000000..ce0e24a60 --- /dev/null +++ b/two-sum/Bumsu-Yi.py @@ -0,0 +1,3 @@ +""" +https://leetcode.com/problems/two-sum/ +""" diff --git a/valid-anagram/Bumsu-Yi.py b/valid-anagram/Bumsu-Yi.py new file mode 100644 index 000000000..c16533dc8 --- /dev/null +++ b/valid-anagram/Bumsu-Yi.py @@ -0,0 +1,3 @@ +""" +https://leetcode.com/problems/valid-anagram/ +""" diff --git a/valid-palindrome/Bumsu-Yi.py b/valid-palindrome/Bumsu-Yi.py new file mode 100644 index 000000000..4c5c29f71 --- /dev/null +++ b/valid-palindrome/Bumsu-Yi.py @@ -0,0 +1,3 @@ +""" +https://leetcode.com/problems/valid-palindrome/ +"""