Meesho Interview Question

Knapsack 0/1 dp problem and longest subarray with sum=0