In the above code, what i m doing is at any particular idx of my weight array … either I pick that stone or leave it with picking has a condition that the weight of that stone should be less than the unused capacity and that color is not picked yet …
I am not able to decide the states of dp for problem … what i m thinking is of 3-d dp … curIdx … cur_leftCapacity … and cur_leftColors