Open evantianx opened 5 years ago
findMissingLetter :: [Char] -> Char
findMissingLetter (x:xs) | head xs == next = findMissingLetter xs
| otherwise = next
where next = succ x
import Data.List
import Data.Char
findMissingLetter :: [Char] -> Char
findMissingLetter cs = head $ [head cs .. last cs] \\ cs
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.
Example:
(Use the English alphabet with 26 letters!)