'Mysterious present' problem was solved
practicing dp problems on topcoder