Amazon Interview Question

A dynamic programming coding question