Google Interview Question

one easy-ish question one dynamic programming