LeetCode 383
Ransom Note
Concepts:
Hashmap
Description: Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise.
Optimal Approach
Initialize a hashmap (an array of length 26). Iterate through the magazine, incrementing count for each character and through the ransom note, decrementing count for each character. Check if all counts are non-negative.
Time: O(n + m)
Space: O(1)