What is wrong with the code for the given problem (Link)?

codeforces
dynamic-programming

#1

Here is the link of the question Boredom (Div 1)
and here is my implementation Ideone Link
Can you please spot the error? It is a very short code. Thanks :slight_smile:


#2

Your code is accepted now.

Check my submission. Just did slight modification in your code.

Actually you are using int and icnt+arr[i-2] can exceed range of int so just replace int with long long and get Accepted.


#3

Oh, silly me. Thanks @inovation123 :slight_smile: