Skip to content

Commit 59c30ce

Browse files
committed
Set up template for second solution
1 parent 026a4ec commit 59c30ce

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

top-k-frequent-elements/KwonNayeon.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
"""
2-
Title: 237. Top K Frequent Elements
3-
Link: https://leetcode.com/problems/top-k-frequent-elements/
4-
5-
Question:
6-
- Given an integer array `nums` and an integer `k`, return the `k` most frequent elements.
7-
- You may return the answer in any order.
2+
Problem: 237. Top K Frequent Elements
83
94
Constraints:
10-
- 1 <= nums.length <= 10^5
11-
- -10^4 <= nums[i] <= 10^4
12-
- k is in the range [1, the number of unique elements in the array].
13-
- The answer is guaranteed to be unique.
5+
- 1 <= nums.length <= 10^5
6+
- -10^4 <= nums[i] <= 10^4
7+
- k is in the range [1, the number of unique elements in the array].
8+
- The answer is guaranteed to be unique.
9+
10+
Time Complexity: O(n log n)
11+
-
1412
15-
Time Complexity:
16-
- O(n log n)
17-
Space Complexity:
18-
- O(n)
13+
Space Complexity: O(n)
14+
-
1915
"""
2016

2117
# Original Solution

validate-binary-search-tree/KwonNayeon.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- The number of nodes in the tree is in the range [1, 10^4].
44
- -2^31 <= Node.val <= 2^31 - 1
55
6+
<Solution 1: 재귀>
67
Time Complexity: O(n)
78
- 트리의 모든 노드를 한 번씩 방문함
89
@@ -40,3 +41,11 @@ def validate(node, min_val, max_val):
4041

4142
return validate(root, float("-inf"), float("inf"))
4243

44+
"""
45+
<Solution 2: 반복문>
46+
Time Complexity:
47+
-
48+
49+
Space Complexity:
50+
-
51+
"""

0 commit comments

Comments
 (0)