For this problem, I am using the solution as to which, I am taking the smallest element and maximum element in a range (till where the smallest element is smallest) and then adding all the possible answers in a priority queue
Taking the maximum of them till k times.
Why is it giving wrong?
Stock Selling - DP
actually your code is creating a stack overflow …refer to this code
1 Like
Thanks, I understood the code.