Shopee Interview Question

Asked me to code a dynamic programming problem