Solved using dynamic programming
Memory Efficient DP,just stores last 2 cols and also able 2 find actual items