Skip to content

[bskkimm] WEEK 02 solutions #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 3, 2025
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
Empty file added 3sum/bskkimm.py
Empty file.
23 changes: 23 additions & 0 deletions climbing-stairs/bskkimm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Solution:
def __init__(self):
self.memo = {}

Comment on lines +2 to +4
Copy link
Contributor

Choose a reason for hiding this comment

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

생성자에 저장하는 방법도 있군요!

def climbStairs(self, n: int) -> int:

# n = 3 --> 3: 111, 2: 12, 21: --> 3
# n = 4 --> 4: 1111, 3: 112, 121, 211, 2: 22 --> 5
# n = 5 --< 5: 11111,4: 1112, 1121, 1211, 2111, 3: 221, 212, 122, --> 8
# n = 6 --> 6: 111111, 5: 5, 4: 2211, 1122, 1221, 2112, 1212, 2121, 3: 1 --> 13

# a(n+2) = a(n+1) + a(n)

if n == 1:
return 1
elif n == 2:
return 2

if n in self.memo: # need to return when memo is available w.r.t n
return self.memo[n]

self.memo[n] = self.climbStairs(n-1) + self.climbStairs(n-2)
return self.memo[n]
Empty file.
6 changes: 6 additions & 0 deletions valid-anagram/bskkimm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from collections import Counter
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
# Anagram is a word formed by rearranging each letter of a word exactly once.
# s = "anagram", t = "nagaram"
return Counter(s) == Counter(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

Counter로 비교할 수 있다는 것도 알아갑니다..!

Empty file.