All test cases are not passed

Failing with 2 test cases out of 4!
please tell me the mistake.

@sushantshukla92
5
1 2 3 3 1 your o/p true check it

I am still getting the wrong answer , please check my code.

link of code is-https://ide.codingblocks.com/s/263305

@sushantshukla92 bro check for some cases its giving incorrect now too
5
1 1 2 2 1
do you want me to send your corrected code?

It would be great, if you could send me the corrections in the same code or tell me the mistakes i have done in the logic or syntax ?

ok wait some time i will send

@sushantshukla92 here

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.