242. Valid Anagram

catepk·2021년 8월 25일
0

LeetCode

목록 보기
62/88
post-thumbnail

242. Valid Anagram

문제

Given two strings s and t, return true if t is an anagram of s, and false otherwise.

Example 1:

Input: s = "anagram", t = "nagaram"
Output: true

Example 2:

Input: s = "rat", t = "car"
Output: false

Constraints:

1 <= s.length, t.length <= 5 * 10^4
s and t consist of lowercase English letters.

풀이

class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        return sorted(s) == sorted(t)
profile
hello

0개의 댓글