Created
June 22, 2017 17:40
-
-
Save tomanistor/b10a36cafdb024927c82b3d10ade04a1 to your computer and use it in GitHub Desktop.
Revisions
-
tomanistor created this gist
Jun 22, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ ### Find the missing letter 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: ``` ['a','b','c','d','f'] -> 'e' ['O','Q','R','S'] -> 'P' ``` (Use the English alphabet with 26 letters!) Have fun coding it and please don't forget to vote and rank this kata! :-) I have also created other katas. Take a look if you enjoyed this kata! This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ function findMissingLetter(array) { var string = array.join(""); for (var i = 0; i < string.length; i++) { if (string.charCodeAt(i + 1) - string.charCodeAt(i) != 1) { return String.fromCharCode(string.charCodeAt(i) + 1); } } }