Amazon Interview Question

leetcode two pointer question, dynamic programming question