solved hackerrank algo warmup game-of-thrones-1