Skip to main content

Accenture

Accenture OA-3 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:

·       The first line contains an integer array A, representing the array of numbers.

·       The second line contains 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

  • Each element in array A should be an integer.
  • N should be a positive integer and equal to the length of array A.

Example

Sample Input:

1 2 3 4 5 6
6

Sample Output:

odd even odd even odd even

Explanation:
For each element in the array:

  • 1 is odd, so the first label is "odd".
  • 2 is even, so the second label is "even".
  • 3 is odd, so the third label is "odd".
  • 4 is even, so the fourth label is "even".
  • 5 is odd, so the fifth label is "odd".
  • 6 is even, so the sixth label is "even".

Thus, the output string is "odd even odd even odd even".