Google Interview Question

Dynamic programming problem and array membership problem