A ransom note can be formed by cutting words our of a magazine to form a new sentence. How would you figure out if a ransom note (represented as a string) can be formed from a given magazine (string).
Create map with words from magazine and number of their occurance. Then check if all words from ransom note could be from magazine.
A ransom note can be formed by cutting words our of a magazine to form a new sentence. How would you figure out if a ransom note (represented as a string) can be formed from a given magazine (string).
Create map with words from magazine and number of their occurance. Then check if all words from ransom note could be from magazine.