← Back to challenges

Find Missing Alphabets

JavaScriptHardstringslogicvalidation

Instructions

Create a function that takes a string str containing only letters from a to z in lowercase and returns the missing letter(s) in alphabetical order a-z.

  • A set of letters is given by abcdefghijklmnopqrstuvwxyz.
  • Two sets of alphabets means two or more alphabets.

Examples

missingAlphabets("abcdefghijklmnopqrstuvwxy") ➞ "z"
// "z" is missing.

missingAlphabets("aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyy") ➞ "zz"
// Given string has a set of two alphabets so output will be "zz"

missingAlphabets("innokodakademija") ➞ "cfghjklmnopqrsuvwxyz"

Notes

If the string contains all letters from a-z, return an empty string "".

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.