Why almost two similar codes with same logic are getting different outcomes?
The two solutions for the problem (ETUP) attached below look almost similar and their implementation is also same except for how the N integers are being taken and how the total count of even numbers is being computed.
In SOLUTION 1 the element is stored at the 0th index of array A, then it’s checked for being even or odd, the count variable is incremented if the integer is found even, the count variable is stored at the ith location of the array A.
In SOLUTION 2 the integer is stored in another variable named ele. Instead of having a counter variable, I am directly operating on the array’s i and i-1 location.