Skip to interview prep
Apexed

3. Valid Anagram

EasyArrays & hashing

Given two lowercase strings s and t, return true if t is an anagram of s (same letters, same counts) and false otherwise.

Example 1

Input: s = "listen", t = "silent"
Output: true

Example 2

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

Constraints

  • 1 ≤ s.length, t.length ≤ 5 × 10⁴
  • Lowercase English letters only

Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor

Run checks these cases; the expected output comes from the reference solution. Submit judges all 5 hidden and sample tests.

Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.

Valid Anagram — coding interview practice — Apexed