Setup
Write a function that can add letters together. Each letter will be valued based on their position in the alphabet.
Rules:
- Letters will always be lowercase.
- Letters can overflow (see second to last example of the description)
- If no letters are given, the function should return 'z'
Examples
addLetters('a', 'b', 'c') = 'f' addLetters('a', 'b') = 'c' addLetters('z') = 'z' addLetters('z', 'a') = 'a' addLetters('y', 'c', 'b') = 'd' // notice the letters overflowing addLetters() = 'z'
Tests
addLetters('a', 'b', 'c')
addLetters('z')
addLetters('a','b')
addLetters('c')
addLetters('y', 'c', 'b')
addLetters()
Good luck!
This challenge comes from steffan153 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 yo+challenge@dev.to with your suggestions!
Top comments (8)
C++
Python
Python
Rust solution
Tried to Golf it with JS
Ruby
python
Javascript
Go: