Loading practice problems…
Loading your practice workspace…
Loading code editor…
2 / 29
Sign in
Algorithms/Frequency Counter

Valid Anagram

easy15 min

Given two lowercase strings s and t, return true when t is an anagram of s.

An anagram uses every character from the original string exactly once, but the order may change.

Example 1

Inputs = "anagram", t = "nagaram"

Outputtrue

Example 2

Inputs = "rat", t = "car"

Outputfalse

Constraints

  • 1 ≤ s.length, t.length ≤ 50,000
  • Both strings contain lowercase English letters.
Frequency CounterStrings