If anyone is interested in a recursive solution to the second part :) : //Get spell and journal name string spellName = spell->revealScrollName(); string journal = SpellJournal::journal; // Initialize the memoization table with -1 (indicating uncomputed) int n = spellName.size(); int ...
// https://www.hackerrank.com/challenges/magic-spells/problem #include <iostream> #include <vector> #include <string> using namespace std; class Spell { private: string scrollName; public: Spell(): scrollName("") { } Spell(string name): scrollName(name) { } virtual ~Spell() { } str...