Skip to content

[jiunshinn] WEEK 02 solutions #1771

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 1 commit into from
Aug 3, 2025
Merged
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
22 changes: 22 additions & 0 deletions valid-anagram/jiunshinn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# time complexity O(n)
# space complexity O(n)


class Solution:
def isAnagram(self, s: str, t: str) -> bool:
if len(s) != len(t):
return False

counter_s = {}
counter_t = {}

for char in s:
counter_s[char] = counter_s.get(char, 0) + 1

for char in t:
counter_t[char] = counter_t.get(char, 0) + 1

if 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.

return counter_s == counter_t로 줄일 수 있습니다

return True
else:
return False