It’s showing wrong answer.
Can anyone help me that why i am getting a wrong answer or provide me a testcase where my soln fails?
It’s showing wrong answer.
Can anyone help me that why i am getting a wrong answer or provide me a testcase where my soln fails?
1
4
2 1 1 2
Expected output:
4
Your Output:
2
Simple solution:
Run a loop from start to end and count number of odd numbers in array. Also note first and last index of an odd number.
if count is even, answer is N
else answer is max(N - left, right-1) (1-based indexing)
Solution Link: https://www.codechef.com/viewsolution/16479202
How did you made that button?
@kunnu120, See this sign adjacent to Bold and Italic options. Just click there and magic…
Couldn’t ad image to comment, so posted a new answer…
See answer below…
Thank you taran_1407 (ಥـْـِـِـِـْಥ)
No problem.