Skip to content

[devyejin] WEEK 02 solutions #1746

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 2 commits 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
14 changes: 14 additions & 0 deletions valid-anagram/devyejin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from collections import Counter
class Solution(object):
def isAnagram(self, s, t):
# return Counter(s) == Counter(t)

# str에서 제공하는 count 함수 활용
if len(s) != len(t):
return False
for i in set(s):
if s.count(i) != t.count(i):
Copy link
Contributor

Choose a reason for hiding this comment

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

set + count()라는 아이디어는 이해하기 쉽지만 count()는 문자열 전체를 순회하기 때문에 비효율적입니다. Counter나 정렬 방식 고려해보시길 바랍니다.

return False
return True