Extend - Breaking bricks JAN LONG 2020

Question lInk :
https://www.codechef.com/JAN20A/problems/BRKBKS/
https://www.codechef.com/JAN20B/problems/BRKBKS/

I want to know how to solve this above problem if the given elements not just 3 but an array whose length <= 10^5

Help me with this @ssjgz @waqar_ahmad224 @l_returns @aryanc403 @tmwilliamlin

2 Likes

I think you don’t need to reverse at all…

1 Like

You can do this using memoized recursion…
Look at my solution I used recursion. But you can use memoization to optimize.
my solution