Skip to content

Commit 1f66252

Browse files
committed
주석 추가
1 parent 10aaf70 commit 1f66252

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

leetcode3/변지협/v2/4006. Count Valid Prefixes.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2+
'''
3+
1. 아이디어 :
4+
0과 1의 개수가 1 이하로 차이나면 ans에 넣는 식으로 구한다.
5+
6+
2. 시간복잡도 :
7+
o(n^2)
8+
9+
3. 자료구조/알고리즘 :
10+
완전탐색
11+
'''
12+
113
class Solution(object):
214
def countValidPrefixes(self, s):
315
"""

leetcode3/변지협/v2/648. Replace Words.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
'''
2+
1. 아이디어 :
3+
prefix에 있는 단어를 완전 탐색으로 찾아서 바꾸는 형태로 진행한다.
4+
for i in lst 이렇게 하면 시간 초과 나는데
5+
for i in dic 이렇게 하면 시간 초과가 안난다.
6+
왜냐하면 dic은 해시맵이기 때문에 검색 시간이 o(1)이 걸리고, lst는 리스트기 때문에 검색 시간이 o(n)이 걸린다.
7+
8+
2. 시간복잡도 :
9+
o(n^2)
10+
11+
3. 자료구조/알고리즘 :
12+
완전탐색
13+
'''
114
class Solution(object):
215
def replaceWords(self, dictionary, sentence):
316
"""

0 commit comments

Comments
 (0)