242-Valid-Anagram

Sat 17 May 2025

https://leetcode.com/problems/valid-anagram

import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
  def isAnagram(self, s: str, t: str) -> bool:
    if len(s) != len(t):
      return False

    dict = Counter(s)

    for c in t:
      dict[c] -= 1
      if dict[c] < 0:
        return False

    return True
new Solution().isAnagram()

Score: 5

Category: leetcode