I followed the recursive approach without using any dp. It still passes all the test case. My approach included simply buying at i day and selling at all i…n days and recursively finding the best solution. But the time complexity is 3^n. How can i reduce it?
Solving using top down
it is just like a knapsack problem and it can be solved with filling the table bottom up manner.
solution will be of O(n^2*k)