Skip to content

Commit 0158a69

Browse files
authored
[jeongyunjae] WEEK 02 solutions (#1755)
* [main] valid anagram solution * [main] climbStairs solution
1 parent 5bc1630 commit 0158a69

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

climbing-stairs/jeongyunjae.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution:
2+
def climbStairs(self, n: int) -> int:
3+
dp = [-1]
4+
5+
for i in range(1,n+1):
6+
if i == 1 or i == 2:
7+
dp.append(i)
8+
continue
9+
10+
dp.append(dp[i-1] + dp[i-2])
11+
12+
return dp[n]

valid-anagram/jeongyunjae.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
def isAnagram(self, s: str, t: str) -> bool:
3+
sort_s = ''.join(sorted(s))
4+
sort_t = ''.join(sorted(t))
5+
6+
return sort_s == sort_t

0 commit comments

Comments
 (0)