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 fcc3d6e commit 3320013Copy full SHA for 3320013
โvalid-anagram/pmjuu.pyโ
@@ -0,0 +1,11 @@
1
+from collections import Counter
2
+
3
+class Solution:
4
+ def isAnagram(self, s: str, t: str) -> bool:
5
+ return Counter(s) == Counter(t)
6
7
+# Python์ collections.Counter๋ ์ ๋์ฝ๋ ๋ฌธ์๋ฅผ ์ง์ํฉ๋๋ค.
8
+# ์๊ฐ๋ณต์ก๋: O(n)
9
+ # Counter๋ ํด์ ํ ์ด๋ธ ๊ธฐ๋ฐ์ ์ฐ์ฐ์ผ๋ก ๋์ํ๋ฉฐ, ๊ฐ ๋ฌธ์์ด์ ๋ฌธ์๋ฅผ ํ ๋ฒ์ฉ ์ํํฉ๋๋ค.
10
+# ๊ณต๊ฐ๋ณต์ก๋: O(n)
11
+ # ๊ฐ ๋ฌธ์์ด์ ๋ํด Counter ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ฏ๋ก, ์ต์ ์ ๊ฒฝ์ฐ ๊ฐ ๋ฌธ์๋ง๋ค ๋น๋๋ฅผ ์ ์ฅํ๋ ๋ฐ O(n) ํฌ๊ธฐ์ ํด์ํ ์ด๋ธ์ด ํ์ํฉ๋๋ค.
0 commit comments