Files
leetcode/242-valid_anagram/python/242.py
2025-02-12 12:33:39 +00:00

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