I can’t able to figure out where I did wrong here is my code link my code.
My approach:
at current hour, getting min price from the [current hour, current hour + h - 1]
- if the min is greater than the current hour price, then I’m buying all the enzymes till [current hour + h - 1]
- if min is lesser than or equal current hour, then i’m finding min in the range of [current hour, current hour + min - 1] like that I’m recursing till I found a sub-section to buy.
Can anyone tell me what’s wrong with this approach?
Problem link https://www.spoj.com/problems/TNVFC1M/