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 026e627 commit 2cb3699Copy full SHA for 2cb3699
valid-anagram/heypaprika.py
@@ -0,0 +1,18 @@
1
+"""
2
+복잡도 : 예상 -> 예상한 이유
3
+
4
+시간 복잡도 : O(n) -> 배열의 길이 만큼 연산하기 때문
5
+공간 복잡도 : O(1)? -> 생성한 count_list 배열이 상수이기 때문
6
7
+class Solution:
8
+ def isAnagram(self, s: str, t: str) -> bool:
9
+ count_list = [0] * 26
10
+ for s_char in s:
11
+ count_list[ord(s_char) - ord('a')] += 1
12
+ for t_char in t:
13
+ count_list[ord(t_char) - ord('a')] -= 1
14
+ for count in count_list:
15
+ if count != 0:
16
+ return False
17
+ return True
18
0 commit comments