Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions valid-anagram/TreeStone94.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
# 애너그램은 원래의 모든 글자를 정확히 한 번 사용하여 다른 단어나 구절의 글자를 재배열하여 형성된 단어나 구절입니다.
return sorted(s) == sorted(t)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 문자 빈도를 직접 비교하는 방식으로 풀었는데 sorted()로 이렇게 깔끔하게 풀 수 있군요 ㅎㅎ
덕분에 좋은 방법 알게 됐습니다!


18 changes: 18 additions & 0 deletions valid-palindrome/TreeStone94.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Solution:
def isPalindrome(self, s: str) -> bool:
answer = ""
for c in s:
o = ord(c)
if 65 <= o <=90:
answer += chr(o+32)
elif 97 <= o <= 122:
answer += c
elif 48 <= o <= 57:
answer += c

if answer == "" or answer == answer[::-1]:
return True
else:
return False


Loading