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
a = "listen", b = "silent"truea = "apex", b = "apdx"falseHints
- Quick reject if the lengths differ.
- Count characters of a, then subtract using characters of b; all counts must end at zero.
Tests
Solved on this device only. Sign in with Google to keep your progress across devices.
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. Keyboard users: press Esc then Tab to move focus out of the editor.