-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathproblem.txt
19 lines (13 loc) · 1.06 KB
/
problem.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
This is from https://www.hackerrank.com/challenges/magic-spells/problem
You are battling a powerful dark wizard. He casts his spells from a distance, giving you only a few seconds to react and conjure
your counterspells. For a counterspell to be effective, you must first identify what kind of spell you are dealing with.
The wizard uses scrolls to conjure his spells, and sometimes he uses some of his generic spells that restore his stamina. In that
case, you will be able to extract the name of the scroll from the spell. Then you need to find out how similar this new spell is
to the spell formulas written in your spell journal.
Input Format
The wizard will read scrolls, which are hidden from you.
Every time he casts a spell, it's passed as an argument to your counterspell function.
Output Format
After identifying the given spell, print its name and power.
If it is a generic spell, find a subsequence of letters that are contained in both the spell name and your spell journal.
Among all such subsequences, find and print the length of the longest one on a new line.