val [ ] is for storing maximum profit for each weight wt [ ] is for storing weights n number of item W maximum capacity of bag dp [ W + 1 ] to store final result
def KnapSack ( val , wt , n , W ) : NEW_LINE