목차

Valid Anagram

ps
링크leetcode.com/…
출처LeetCode
문제 번호242
문제명Valid Anagram
레벨Easy
분류

기초

시간복잡도O(n)
인풋사이즈n<=5*10^4
사용한 언어python 3.14
제출기록19.5MB / 3ms
최고기록0ms
해결날짜2026/04/24

풀이

코드

problems/leetcode/q0242.py
"""Solution code for "LeetCode 242. Valid Anagram".

- Problem link: https://leetcode.com/problems/valid-anagram/
- Solution link: http://www.teferi.net/ps/problems/leetcode/242
"""

import collections


class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        return collections.Counter(s) == collections.Counter(t)