Google interview question

Related to Dynamic programming using map/dictionary(in js)