FastPrepFastPrep
Problem Brief

Odd One Out

INTERNOA

Analyze the difference in adjacent letters of the alphabet given a string. Given an input sequence of words, find the 'Odd One Out' by checking the difference between adjacent letters. The element having a distinct difference is the 'Odd One Out.'

Function Description

Complete the function findOdd in the editor.

findOdd has the following parameter(s):

  1. string series[n]: an array of strings

Returns

string: the odd one out.

1Example 1

Input
series = ["ACB", "BDC", "CED", "DEF"]
Output
"DEF"
Explanation

In the first three strings, the differences between the letters are (+2, -1), e.g. 'C' - 'A' = 2, 'B' - 'C' = -1. In the last string, the differences are (+1, +1). "DEF" is the odd one out.

Constraints

Limits and guarantees your solution can rely on.

  • 3 ≤ n ≤ 26
  • 2 ≤ length of series[i] ≤ 26
  • All strings are uppercase English letters only.
  • Within a test case, all strings are of equal length.
public String findOdd(String[] series) {
  // write your code here
}
Input

series

["ACB", "BDC", "CED", "DEF"]

Output

"DEF"

Sign in to submit your solution.