Coupang Interview Question

coding question was related to dynamic programming