Meesho interview question

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