Skip to content
Onsite

Odd Sum vs Even Sum

EasyP3Coding

Add up the odd elements of arr and, separately, the even elements. Return "Odd" if the sum of the odd elements is strictly greater than the sum of the even elements, otherwise "Even".

Example 1

Input
arr = [1,2,3,4]
Output
"Even"
Why
Odd sum 4, even sum 6.

Example 2

Input
arr = [5,2]
Output
"Odd"
Why
Odd sum 5, even sum 2.

Example 3

Input
arr = [2,4,1]
Output
"Even"

Constraints

  • 1 <= arr.length <= 10^5
  • -10^4 <= arr[i] <= 10^4

Hints

Run checks the 3 visible tests, Submit all 8.