We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c981bfb commit 35cfa41Copy full SHA for 35cfa41
palindromic-substrings/jinah92.py
@@ -1,4 +1,7 @@
1
-# O((LogN)^N) times, O(1) spaces
+# 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)이 소요됨
5
class Solution:
6
def countSubstrings(self, s: str) -> int:
7
sub_str_len = 1
0 commit comments