Unable to clear all testcases

hi @goyalvivek
can u comment out ur code…

please check, I have commented the code

hey, sry for delay…
consider a input which contains only one element
expected o/p is that single element only…
ur code gives 0…

https://ide.codingblocks.com/s/654986 Still not able to clear 1 testcase

Okay, will check where ur code is failing

hi, just tell which test case no is it failing on when u submit?

Teatcase 2 shows wrong ans

1<=N<=10^7
but u are restricting array size to int a[1000003]
so just write a[n], i think it should work…

https://ide.codingblocks.com/s/655119 please take a look

Unable to clr testcase 1

sir, please help with the doubt

I checked the test case input… it’s failing for the case of n is very large and it contains all elements of same value…

so, what can we do abt that?

I am trying to figure out that, bcoz logic is correct only…

please take a look https://ide.codingblocks.com/s/655119


refer this once…

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.