Can somebody provide me with how to construct the optimal array, or construct the dp table/array for sum?
Problem link : Sherlock And Cost
I am able to partially solve it for specific test cases, but still I am failing for ~60% of other type of test cases.
My code- ideone link (Tell if its not visible/accessible, I will paste my code here then.)
EDIT- Updated link. Please have a look, if needed.