HARRY - Editorial

PROBLEM LINK:

Practice
Contest

Author: mesksr
Editorialist: mesksr

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Strings

PROBLEM:

Given a main string (potion) and several other strings (ingredients). We need to find if potion can be made.

EXPLANATION:

We need to create two counter arrays of size 26.
In first counter array record the frequency of each alphabet (‘a’ to ‘z’) from potion.
In second counter array record the frequency of each alphabet (‘a’ to ‘z’) from all ingredients.
If for any alphabet (‘a’ to ‘z’), corresponding frequency from potion > corresponding frequency from all ingredients, then potion cannot be made.

AUTHOR’S SOLUTION:

Author’s solution can be found here.