Sollicitatievraag bij Google

One DSA question based on dynamic programming. Difficulty level -high