WA in ZCO problem - Break up

Hello ,

I am getting wrong answer in Break up problem from ZCO , i tried many test cases and i don’t find any test case which gives wrong answer
I even checked for silly mistakes

My code : https://www.codechef.com/viewsolution/34491660

I request @everule1 @ssjgz to pls find a test case where this fails

Thanks
:))

5
1 2 2 1 3

Correct answer

2

It is printing 2 only :slight_smile:

It’s printing 4 on the codechef ide. Possibly undefined behaviour, or the linked code is an old solution.
Here’s my solution if you want to compare answers

No , i am running on the same code
Don’t know why

I didn’t understand the code
I saw few people’s code and they have done same thing like me but they have done top-down approach rather than bottom-up

May I know why bottom-up doesn’t work while top-down works ?

Thanks a lot @everule1
:slight_smile:

You’ve written i!=0 instead of j!=0. Then your code gets AC.

Thank you very much sir

I checked more than 10+ codes and everyone had done top-down but i am very happy i did bottom-up

Thanks thanks thanks a lot @everule1
:slight_smile: :slight_smile: