Skip to content

Commit eff1dff

Browse files
authored
Merge pull request #2410 from TreeStone94/main
[TreeStone94] WEEK 02 solutions
2 parents d90d309 + f65a8cc commit eff1dff

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

β€Žvalid-anagram/TreeStone94.pyβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Solution:
2+
def isAnagram(self, s: str, t: str) -> bool:
3+
# μ• λ„ˆκ·Έλž¨μ€ μ›λž˜μ˜ λͺ¨λ“  κΈ€μžλ₯Ό μ •ν™•νžˆ ν•œ 번 μ‚¬μš©ν•˜μ—¬ λ‹€λ₯Έ λ‹¨μ–΄λ‚˜ ꡬ절의 κΈ€μžλ₯Ό μž¬λ°°μ—΄ν•˜μ—¬ ν˜•μ„±λœ λ‹¨μ–΄λ‚˜ κ΅¬μ ˆμž…λ‹ˆλ‹€.
4+
return sorted(s) == sorted(t)
5+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution:
2+
def isPalindrome(self, s: str) -> bool:
3+
answer = ""
4+
for c in s:
5+
o = ord(c)
6+
if 65 <= o <=90:
7+
answer += chr(o+32)
8+
elif 97 <= o <= 122:
9+
answer += c
10+
elif 48 <= o <= 57:
11+
answer += c
12+
13+
if answer == "" or answer == answer[::-1]:
14+
return True
15+
else:
16+
return False
17+
18+

0 commit comments

Comments
Β (0)