Charles Schwab interview question

It was about a DP problem