You have a bag of letter tiles (a string, one character per tile) and want to spell word. Each tile can be used at most once. Return True if word can be spelled, otherwise False.
Examples
Input: word = "hello", tiles = "leholx"
Output: True
Input: word = "hello", tiles = "helo"
Output: False
Explanation: only one "l" tile is available.
Constraints
0 <= len(word), len(tiles) <= 10**5- Lowercase letters only. An empty
wordcan always be spelled. - Target complexity: O(n + m) time.
Goals
- Compare two frequency counts
- Consume resources without going negative