As reported: IBM India, Application Developer – Cloud Fullstack, online assessment (HackerRank, 60 minutes, two problems, 2026). Problem 2: "plusMult".
You are given an integer array A. Build two values:
R_evenfrom the elements at even indicesA[0], A[2], A[4], …: start withA[0], then multiply byA[2], addA[4], multiply byA[6], addA[8], and so on, alternating; take the result modulo 2. That is(((A0 × A2) + A4) × A6) + A8 … mod 2.R_oddthe same way from the elements at odd indicesA[1], A[3], A[5], …: start withA[1], multiply byA[3], addA[5], multiply byA[7], …, modulo 2.
Return "ODD" if R_odd > R_even, "EVEN" if R_even > R_odd, and "NEUTRAL" if they are equal.
Example
A = [12,3,6,7,13,12] -> "NEUTRAL"
R_even = ((12 × 6) + 13) mod 2 = 85 mod 2 = 1; R_odd = ((3 × 7) + 12) mod 2 = 33 mod 2 = 1.
Clarifications
- "Modulo 2" means the parity of the exact result,
0or1, also for negative numbers (−3 mod 2 = 1). - A sequence with a single element is just that element mod 2.
Constraints: 2 ≤ n ≤ 10^5; −10^9 ≤ A[i] ≤ 10^9.
Code runner format: one JSON value per line: A. Implement plusMult(A) returning "ODD", "EVEN" or "NEUTRAL"; the harness prints it as a JSON string.