Skip to main content

Accenture

Accenture OA-10 2024

Problem Description

Jack has an array A of length N. He wants to label whether the number in the array is even or odd. Your task is to help him find and return a string with labels "even" or "odd" in sequence according to which the numbers appear in the array.

Input Format:

  • input1: An integer array A, representing the array of numbers.
  • input2: An integer N, representing the length of the array.

Output Format:

Return a string with labels "even" or "odd" in sequence according to which the numbers appear in the array.

Constraints:

  • 1 <= N <= 10^5
  • 1 <= A[i] <= 10^9

Example

Sample Input:

input1: [1, 2, 3, 4, 5, 6]
input2: 6

Sample Output:

odd even odd even odd even

Explanation:
In the given array [1, 2, 3, 4, 5, 6], the first number (1) is odd, the second number (2) is even, and so on. Therefore, the output string will be "odd even odd even odd even".