Loading Now

findMissingLetter

Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array.

You will always get an valid array. And it will be always exactly one letter be missing. The length of the array will always be at least 2. The array will always contain letters in only one case. (Use the English alphabet with 26 letters!)

Examples:

  • If array = ["a","b","c","d","f"] then missingLetter = "e"
  • If array = ["O","Q","R","S"] then missingLetter = "P"

Input/Output:

  • [Running time] 0.5s with C++, 3s with Java and C#, 4s with  Python, Go and JavaScript.
  • [Input] Array of chars array
    2 ≤ array.length ≤ 25

  • [Output] String
    The letter which is missing.

Post Comment

Contact