Hello! I am solving Pictures with Kittens (easy version).
My approach is pretty much like knapsack. Suppose we are at index i, we have 2 options either to not pick or to pick. If our last pick and current index different == k then we will have to pick it.
my dp state is dp[curr][taken][last] which is what is our answer if we are at index = curr, and have took taken elements and our previous taken = last.
But this approach is giving WA on test case 45. Can anyone please tell me what i am missing?
Here is my solution: LINK
Thanks.