Valid Anagram

EasyHash Maps and Sets

Given two strings s and t, return true if t is an anagram of s, and false otherwise.

Two strings are anagrams when they contain exactly the same characters, each one the same number of times, possibly in a different order.

Constraints

  • 1 <= s.length, t.length <= 5 * 10^4
  • s and t contain lowercase English letters only.

Examples

Example 1

Input: s = "dusty", t = "study"
Output: true

Both words use d, u, s, t and y exactly once each.

Example 2

Input: s = "teeth", t = "theme"
Output: false

"teeth" has two t's and no m; "theme" has one t and an m.

Example 3

Input: s = "a", t = "ab"
Output: false

Different lengths can never be anagrams.

JavaScript you'll use: Map and Set Strings and characters

/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
function isAnagram(s, t) {
  
}

Ctrl/⌘ + ' runs the examples, Ctrl/⌘ + Enter submits. Use console.log freely: output shows under Console. In the editor, press Esc then Tab to move focus out.