Maximum Difference Problem Statement

Given an array ARR of N elements, your task is to find the maximum difference between any two elements in ARR.

If the maximum difference is even, print EVEN; if it is odd, print ODD.

Input:

The first line of input contains an integer T denoting the number of test cases.
Each test case consists of:
- The first line contains an integer N, the length of the array ARR.
- The second line contains N space-separated integers representing the elements of ARR.

Output:

For each test case, output a single line containing either EVEN or ODD based on the parity of the maximum difference.

Example:

Input:
ARR = [1, 10, 5, 2, 8, 1]
Output:
ODD

Explanation: The maximum difference is between 10 and 1, which is 9. Since 9 is odd, the output is ODD.

Constraints:

  • 1 <= T <= 100
  • 1 <= N <= 5000
  • 1 <= ARR[i] <= 10^9

Note: You do not need to print anything; just implement the function to return the result.

AnswerBot
4mo

Find the maximum difference between any two elements in an array and determine if it is even or odd.

  • Iterate through the array to find the maximum and minimum elements.

  • Calculate the difference between ...read more

Help your peers!
Select
Add answer anonymously...

Raja Software Labs Software Developer Intern interview questions & answers

A Software Developer Intern was asked Q. Fibonacci Membership Check Given an integer N, determine if it is a member of th...read more
A Software Developer Intern was asked Q. String Palindrome Verification Given a string, your task is to determine if it i...read more
A Software Developer Intern was asked Q. Selection Sort Algorithm Selection sort is a sorting technique that works by rep...read more

Popular interview questions of Software Developer Intern

A Software Developer Intern was asked Q1. Fibonacci Membership Check Given an integer N, determine if it is a member of th...read more
A Software Developer Intern was asked Q2. String Palindrome Verification Given a string, your task is to determine if it i...read more
A Software Developer Intern was asked Q3. Selection Sort Algorithm Selection sort is a sorting technique that works by rep...read more
Raja Software Labs Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits