The Letter-Match Puzzle
Advanced SolvedA word-game feature lets users check whether two words are built from exactly the same letters. Two strings match when each character appears the same number of times in both — order does not matter, but every letter must be accounted for. Build the check the feature calls on each guess.
Implement `solve(String a, String b)` to return true if `a` and `b` are anagrams (same characters with the same counts), false otherwise.
Examples
Input
a = "listen", b = "silent"Output
trueInput
a = "apex", b = "apdx"Output
falseHints
- Quick reject if the lengths differ.
- Count characters of a, then subtract using characters of b; all counts must end at zero.
Tests
Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.