Are the Two Strings Anagrams? (Set 8)

Easy

Given two lowercase strings first and second, return true when one is an anagram of the other — the same letters with the same counts, in any order.

Are the Two Strings Anagrams? (Set 8) — the data. This set runs 4 cases: first is a string of 4–9 characters; second is a string of 5–10 characters. The hidden cases are the largest of the set.

Example 1

isAnagramPair()
Input
first = "yutl", second = "yutlq"
Output
false

Why

`isAnagramPair` returns `false` for this input.

Example 2

isAnagramPair()
Input
first = "yqbc", second = "yqbcq"
Output
false

Why

`isAnagramPair` returns `false` for this input.
Constraints
0 <= first.length, second.length <= 10^4
Lowercase letters only.
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

StringsHash Table

Implement isAnagramPair in the editor and return the answer — printing it is never graded.