code.davidloor.com
EEasy· hash-map· string· sorting

Valid Anagram

Valid Anagram

Given two strings s and t, return true if t is an anagram of s, and false otherwise. An anagram is a word formed by rearranging the letters of another word using all the original letters exactly once.

Example

Input: s = "anagram", t = "nagaram" → Output: true Input: s = "rat", t = "car" → Output: false

Constraints

  • 1 ≤ s.length, t.length ≤ 5 × 10⁴
  • s and t consist of lowercase English letters.

Entry — isAnagram

Grading — exact over 5 tests

Stuck? Browse algorithmic patterns → or read the Python / JS foundations.
Awaiting first run
Reference solution unlocks after a run & 60 s of work.