14 lines
357 B
Python
14 lines
357 B
Python
# 242. Valid Anagram
|
|
#
|
|
# https://leetcode.com/problems/valid-anagram/
|
|
#
|
|
# Given two strings s and t, return true if t is an anagram of s, and false otherwise.
|
|
|
|
def isAnagram(s: str, t: str) -> bool:
|
|
if len(s) != len(t):
|
|
return False
|
|
for i in range(len(s)):
|
|
if s.count(s[i]) != t.count(s[i]):
|
|
return False
|
|
return True
|