Skip to content

Commit 7cbbaff

Browse files
committed
chore: 시간, 공간 복잡도 추가
1 parent 7bcf9bc commit 7cbbaff

File tree

6 files changed

+87
-1
lines changed

6 files changed

+87
-1
lines changed

.idea/workspace.xml

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

best-time-to-buy-and-sell-stock/saysimple.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
33
"""
4+
# - time complexity : O(n)
5+
# - space complexity : O(n)
46

57
class Solution:
68
def maxProfit(self, prices: List[int]) -> int:

contains-duplicate/saysimple.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
https://leetcode.com/problems/contains-duplicate/
33
"""
4+
# - time complexity : O(n)
5+
# - space complexity : O(n)
46

57
class Solution:
68
def containsDuplicate(self, nums: List[int]) -> bool:

two-sum/saysimple.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
"""
22
https://leetcode.com/problems/two-sum/
33
"""
4+
# - time complexity : O(nlogn)
5+
# - space complexity : O(n)
46

57
class Solution:
68
def twoSum(self, nums: List[int], target: int) -> List[int]:
79
s, e = 0, len(nums) - 1
8-
arr = [[n, i] for i, n in enumerate(nums)]
10+
arr = [nums[i]:=[n,i] for i, n in enumerate(nums)]
911

1012
arr.sort(key=lambda x: x[0])
1113

valid-anagram/saysimple.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
https://leetcode.com/problems/valid-anagram/
33
"""
4+
# - time complexity : O(n)
5+
# - space complexity : O(n)
46

57
from collections import Counter
68

valid-palindrome/saysimple.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
https://leetcode.com/problems/valid-palindrome/
33
"""
4+
# - time complexity : O(n)
5+
# - space complexity : O(n)
46

57
class Solution:
68
def isPalindrome(self, s: str) -> bool:

0 commit comments

Comments
 (0)