Amazon Interview Question

I was asked a popular problem on two-pointers. After that I was asked a dynamic programming questions.