Check if string has all the letters of the alphabet

前端 未结 15 1319
终归单人心
终归单人心 2020-12-19 17:51

What would be the best logic to check all the letters in a given string.

If all the 26 letters are available in the provided string, I want to check that and perform

15条回答
  •  庸人自扰
    2020-12-19 18:06

    I'd go for a sieve algorithm on the 26 letters. Just my $.02.

    Edit: An array of 26 values that represent the 26 letters of the alphabet. Then scan the string, checking each letter as you encounter it. At the end, check if the 26 letters have been checked.

提交回复
热议问题