Amazon interview question

leetcode two pointer question, dynamic programming question