Skip to content

Commit 35cfa41

Browse files
committed
chore: 시간복잡도 수정 및 설명 추가
1 parent c981bfb commit 35cfa41

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

palindromic-substrings/jinah92.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# O((LogN)^N) times, O(1) spaces
1+
# O(N^3) times, O(1) spaces
2+
# 내부 while문의 관계가 외부 while문의 sub_str_len에 따라 반복횟수가 줄어드므로, 1+2+...N = N(N-1)/2 = O(N2) 시간 소요
3+
# 추라고 내부 while에서 sub_str_len에 따라 s가 인덱싱되므로 최대 O(N) 시간이 소요
4+
# 최종적으로 O(N^2 * N) = O(N^3)이 소요됨
25
class Solution:
36
def countSubstrings(self, s: str) -> int:
47
sub_str_len = 1

0 commit comments

Comments
 (0)