Pregunta de entrevista de Amazon

LeetCode Array-based question solved using DP