School Accuracy: 67.08%
Submissions: 999 Points: 0
Given an array Arr of N integers.Find the sum of values of even and odd index positions separately.
The sum of elements at odd places i.e
at 1st,3rd and 5th places are (1+3+5=9)
Similarly,the sum of elements at even
places i.e. at 2nd and 4th places are
The sum of elements at odd places
is (1+1+1=3).Similarly, the sum of
elements at even places is (1+1=2)
You don't need to read input or print anything.Your Task is to complete the function EvenOddSum() which takes an integer N and an array Arr as input parameters and returns the sum of elements in odd places and in even places separately.
Expected Time Complexity:O(N) Expected Auxillary Space:O(1)