An Interest In:
Web News this Week
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
Daily Challenge 304 - Consecutive Letters
In this challenge, we will check if a string contains consecutive letters as they appear in the English alphabet and if each letter occurs only once.
Rules are: (1) the letters are adjacent in the English alphabet, and (2) each letter occurs only once.
For example: solve("abc")
= True, because it contains a,b,csolve("abd")
= False, because a, b, d are not consecutive/adjacent in the alphabet, and c is missing.solve("dabc")
= True, because it contains a, b, c, dsolve("abbc")
= False, because b does not occur once.solve("v")
= True
All inputs will be lowercase letters.
Tests
solve("abc")
solve("zyx")
solve("azj")
Good luck!
This challenge comes from KenKemau on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email [email protected] with your suggestions!
Original Link: https://dev.to/thepracticaldev/daily-challenge-304-consecutive-letters-1neo
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To