TikTok Interview Question

Tree search and traversing problems , knapsack sometimes too