Same Letters Check
Two strings are rearrangements of each other if one can be turned into the other by reordering its characters.
Given strings a and b, return true if they are rearrangements of each other (same characters with the same counts), otherwise false.
Example 1
Input: a = "listen", b = "silent" Output: true
Example 2
Input: a = "rat", b = "tar " Output: false Explanation: b has an extra space.
Constraints
- 0 <= a.length, b.length <= 5 * 10^4
- Comparison is case-sensitive.
Hint 1
Different lengths can never match.
Hint 2
Count characters of one string, then subtract counts using the other.
Good practice for: Frontend Developer, Backend Developer, Full Stack Developer, Mobile App Developer, Game Developer, Automation Test Engineer
Run checks your code on 2 sample tests. Submit runs all 7 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.