Everpure interview question

Dynamic programming problem leetcode coin