Skip to content

Commit 0c8f197

Browse files
committed
[LC] 240817 add time complexity
1 parent 6139c9c commit 0c8f197

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

contains-duplicate/hajunyoo.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class Solution:
2+
# Time complexity: O(n)
23
def containsDuplicate(self, nums: List[int]) -> bool:
34
string_len = len(nums)
45
set_len = len(set(nums))

kth-smallest-element-in-a-bst/hajunyoo.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99

1010
class Solution:
11+
# Time complexity: O(n)
1112
def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
1213

1314
self.count = 0

number-of-1-bits/hajunyoo.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class Solution:
2+
# Time complexity: O(log n)
23
def hammingWeight(self, n: int) -> int:
34
n = int(n)
45
cnt = 0

palindromic-substrings/hajunyoo.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class Solution:
2+
# Time complexity: O(n^2) = O(n) * O(n)
23
def countSubstrings(self, s: str) -> int:
34
self.count = 0
45
n = len(s)

top-k-frequent-elements/hajunyoo.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
class Solution:
6+
# Time complexity: O(nlogn) -> O(n) + O(nlogn) + O(k)
67
def topKFrequent(self, nums: List[int], k: int) -> List[int]:
78
counter_dict = defaultdict(int)
89

0 commit comments

Comments
 (0)