- It brings me memory of an interview, and I couldn’t believe I used a whole different yet difficult approach in that interview.
mapto store each char of
ranson notewith frequencies.
- Iterate through
magazineand check if char is
in the mapand the value is
Given two stings
magazine, return true if ransomNote can be constructed from magazine and false otherwise.
Each letter in magazine can only be used
once in ransomNote.
Input: ransomNote = "aa", magazine = "ab"