Added memoized solution for problem number 31