Help Pikachu win!

Your Pikachu is fighting Mewtwo in a pokemon battle. Your Pikachu has a set of attacks which have been provided to you as an array of strings and another string describing the entire battle has also been given.
Pikachu can win only if it performs all the attacks one after the other in any sequence.
Write a function which returns the index at which its winning move starts, else return -1.

Input: [thunderbolt, slam, agility, growl]

              kickpunchthunderboltgrowlslamagilityheadbutttackle

Output: 9

4 Likes

Did you find the solution for this?