Frage im Vorstellungsgespräch bei Google

A difficult question (LeetCode Hard) that involved dynamic programming with memoization.