TikTok Interview Question

a classic 2d dp problem on a matrix