Description
Solutions
Submission
Plus Mult Array

A is an array of integers described as {A[0], A[1], A[2], A[3],..., A[n-1]}. Perform the following calculations on the elements of A:

(R_even = (((A[0] × A[2]) + A[4]) × A[6]) + A[8]) × ...) % 2 )

(R_odd = (((A[1] × A[3]) + A[5]) × A[7]) + A[9]) × ...) % 2 )

Notice that zero-indexing is used to calculate R_even and R_odd and they are always modulo 2.

You can then use R_even and R_odd to determine if A is odd, even, or neutral using the criterion below:

  • If R_odd > R_even, then A is ODD.
  • If R_even > R_odd, then A is EVEN.
  • If R_odd = R_even, then A is NEUTRAL.

For example, given the array A = [12,3,5,7,13,12], calculations are:

  • R_even = (A[0] * A[2] + A[4]) % 2 = (12 * 5 + 13) % 2 = 73 % 2 = 1
  • R_odd = (A[1] * A[3] + A[5]) % 2 = (3 * 7 +12) % 2 = 33 % 2 = 1

Since both are 1, the answer is NEUTRAL.

Example 1:

Input:  A = [12, 3, 5, 7, 13, 12]
Output: "NEUTRAL"
Explanation:
Perform the operations as follows: R_even = (12 * 5 + 13) % 2 = 73 % 2 = 1 R_odd = (3 * 7 + 12) % 2 = 33 % 2 = 1 Both R_even and R_odd are equal, hence A is NEUTRAL.
Constraints:

    No constraints are mentioned for input.

Testcase

Result
Case 1

input:

output: