Google Interview Question

Online Test : Dynamic programming. Easy array problem