Imagine you're a detective investigating a mysterious ransom note case! ๐ต๏ธโโ๏ธ You have a ransom note written by a kidnapper and a magazine that might have been used to cut out letters.
Your task is to determine if the ransom note could have been constructed using letters from the magazine. The catch? Each letter in the magazine can only be used once - just like cutting out physical letters from a real magazine!
Goal: Return true if the ransom note can be constructed from the magazine letters, false otherwise.
Example: If the ransom note is "aab" and the magazine is "baa", you can construct the note because the magazine contains exactly the letters needed: one 'b' and two 'a's.
Input & Output
Constraints
- 1 โค ransomNote.length โค 105
- 0 โค magazine.length โค 105
- ransomNote and magazine consist of lowercase English letters.
- Each letter in magazine can only be used once