7 kyu

Alphabetical Addition

2,850 of 11,801user8436785

Description:

Your task is to add up letters to one letter.

The function will be given a variable amount of arguments, each one being a letter to add.

Notes:

  • 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'
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'
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'
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'
add_letters('a', 'b', 'c') = 'f'
add_letters('a', 'b') = 'c'
add_letters('z') = 'z'
add_letters('z', 'a') = 'a'
add_letters('y', 'c', 'b') = 'd' # notice the letters overflowing
add_letters() = 'z'
add_letters(c('a', 'b', 'c')) = 'f'
add_letters(c('a', 'b')) = 'c'
add_letters(c('z')) = 'z'
add_letters(c('z', 'a')) = 'a'
add_letters(c('y', 'c', 'b')) = 'd' # notice the letters overflowing
add_letters(c()) = 'z'
add_letters('a', 'b', 'c') = 'f'
add_letters('a', 'b') = 'c'
add_letters('z') = 'z'
add_letters('z', 'a') = 'a'
add_letters('y', 'c', 'b') = 'd' # notice the letters overflowing
add_letters() = 'z'
{ "a" "b" "c" } add-letters ! "f"
{ "a" "b" } add-letters ! "c"
{ "z" } add-letters ! "z"
{ "z" "a" } add-letters ! "a"
{ "y" "c" "b" } add-letters ! "d" ! notice the letters overflowing
{ } add-letters ! "z"
add_letters({'a', 'b', 'c'}) = 'f'
add_letters({'a', 'b'}) = 'c'
add_letters({'z'}) = 'z'
add_letters({'z', 'a'}) = 'a'
add_letters({'y', 'c', 'b'}) = 'd' // notice the letters overflowing
add_letters({}) = 'z'
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'
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'
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'
add_letters(vec!['a', 'b', 'c']) = 'f'
add_letters(vec!['a', 'b']) = 'c'
add_letters(vec!['z']) = 'z'
add_letters(vec!['z', 'a']) = 'a'
add_letters(vec!['y', 'c', 'b']) = 'd' // notice the letters overflowing
add_letters(vec![]) = 'z'
AddLetters(new char[] {'a', 'b', 'c'}) = 'f'
AddLetters(new char[] {'a', 'b'}) = 'c'
AddLetters(new char[] {'z'}) = 'z'
AddLetters(new char[] {'z', 'a'}) = 'a'
AddLetters(new char[] {'y', 'c', 'b'}) = 'd' // notice the letters overflowing
AddLetters(new char[] {}) = 'z'
AddLetters(New Char() {"a"C, "b"C, "c"C}) = "f"C
AddLetters(New Char() {"a"C, "b"C}) = "c"C
AddLetters(New Char() {"z"C}) = "z"C
AddLetters(New Char() {"z"C, "a"C}) = "a"C
AddLetters(New Char() {"y"C, "c"C, "b"C}) = "d"C ' notice the letters overflowing
AddLetters(New Char() {}) = "z"C
AddLetters([]rune{'a', 'b', 'c'}) = 'f'
AddLetters([]rune{'a', 'b'}) = 'c'
AddLetters([]rune{'z'}) = 'z'
AddLetters([]rune{'z', 'a'}) = 'a'
AddLetters([]rune{'y', 'c', 'b'}) = 'd' // notice the letters overflowing
AddLetters([]rune{}) = 'z'
add_letters(['a', 'b', 'c']) = 'f'
add_letters(['a', 'b']) = 'c'
add_letters(['z']) = 'z'
add_letters(['z', 'a']) = 'a' # note single quotes, we work with Chars
add_letters(['y', 'c', 'b']) = 'd' # notice the letters overflowing
add_letters([] of Char) = 'z'
add_letters(["a", "b", "c"]) = "f"
add_letters(["a", "b"]) = "c"
add_letters(["z"]) = "z"
add_letters(["z", "a"]) = "a"
add_letters(["y", "c", "b"]) = "d" # notice the letters overflowing
add_letters([]) = "z"
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"
add_letters([a, b, c]) = f
add_letters([a, b]) = c
add_letters([z]) = z
add_letters([z, a]) = a
add_letters([y, c, b]) = d % notice the letters overflowing
add_letters([]) = z
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(<String>[]) = 'z'
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"
addletters('a', 'b', 'c') = 'f'
addletters('a', 'b') = 'c'
addletters('z') = 'z'
addletters('z', 'a') = 'a' # note single quotes, we work with Chars
addletters('y', 'c', 'b') = 'd' # notice the letters overflowing
addletters() = 'z'
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'
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'
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'
add_letters(3, {'a', 'b', 'c'}) == 'f'
add_letters(2, {'a', 'b'})      == 'c'
add_letters(1, {'z'})           == 'z'
add_letters(2, {'z', 'a'})      == 'a'
add_letters(3, {'y', 'c', 'b'}) == 'd' // notice letters overflowing
add_letters(0, {})              == 'z'
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"
addLetters(listOf("a", "b", "c")) = "f"
addLetters(listOf("a", "b")) = "c"
addLetters(listOf("z")) = "z"
addLetters(listOf("z", "a")) = "a"
addLetters(listOf("y", "c", "b")) = "d" // notice the letters overflowing
addLetters(listOf()) = "z"
addLetters(List('a', 'b', 'c')) = 'f'
addLetters(List('a', 'b')) = 'c'
addLetters(List('z')) = 'z'
addLetters(List('z', 'a')) = 'a'
addLetters(List('y', 'c', 'b')) = 'd' // notice the letters overflowing
addLetters(List()) = 'z'
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"
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'
addLetters({'a', 'b', 'c'}, 3) = 'f'
addLetters({'a', 'b'}, 2) = 'c'
addLetters({'z'}, 1) = 'z'
addLetters({'z', 'a'}, 2) = 'a'
addLetters({'y', 'c', 'b'}, 3) = 'd' // notice the letters overflowing
addLetters({}, 0) = 'z'
table(letter: ["a", "b", "c"]) = "f"
table(letter: ["a", "b"]) = "c"
table(letter: ["z"]) = "z"
table(letter: ["z", "a"]) = "a"
table(letter: ["y", "c", "b"]) = "d" -- notice the letters overflowing
table(letter: []) = "z"
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"
run_shell(args: ['abc']) = "f"
run_shell(args: ['ab']) = "c"
run_shell(args: ['z']) = "z"
run_shell(args: ['za']) = "a"
run_shell(args: ['ycb']) = "d" # notice the letters overflowing
run_shell(args: ['']) = "z"
(add-letters '(#\a #\b #\c)) ; #\f
(add-letters '(#\z)) ; #\z
(add-letters '(#\a #\b)) ; #\c
(add-letters '(#\c)) ; #\c
(add-letters '(#\z #\a)) ; #\a
(add-letters '(#\y #\c #\b)) ; #\d ; notice the letters overflowing
(add-letters '()) ; #\z
(add-letters [\a \b \c]) ;; \f
(add-letters [\z]) ;; \z
(add-letters [\a \b]) ;; \c
(add-letters [\c]) ;; \c
(add-letters [\z \a]) ;; \a
(add-letters [\y \c \b]) ;; \d ;; notice the letters overflowing
(add-letters []) ;; \z
runBF('abc\0') == 'f'
runBF('ab\0') == 'c'
runBF('z\0') == 'z'
runBF('za\0') == 'a'
runBF('ycb\0') == 'd' // notice the letters overflowing
runBF('\0') == 'z'
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'
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"

Confused? Roll your mouse/tap over here

Algorithms

Similar Kata:

Stats:

CreatedAug 12, 2019
PublishedAug 12, 2019
Warriors Trained30435
Total Skips2192
Total Code Submissions82540
Total Times Completed11801
JavaScript Completions2850
Ruby Completions295
Haskell Completions160
CoffeeScript Completions11
Crystal Completions14
TypeScript Completions191
Python Completions3114
PHP Completions289
Julia Completions30
C++ Completions630
Dart Completions203
Elixir Completions73
Reason Completions7
C Completions292
R Completions67
Factor Completions18
Java Completions1117
Swift Completions325
Racket Completions24
BF Completions28
Go Completions333
Clojure Completions130
C# Completions474
Elm Completions28
Lua Completions94
Nim Completions16
Kotlin Completions276
Groovy Completions39
Scala Completions116
SQL Completions936
Fortran Completions15
Rust Completions178
F# Completions34
Objective-C Completions11
PowerShell Completions66
PureScript Completions10
VB Completions44
Erlang Completions43
CFML Completions26
Prolog Completions18
Shell Completions87
Haxe Completions21
Total Stars351
% of votes with a positive feedback rating88% of 1689
Total "Very Satisfied" Votes1355
Total "Somewhat Satisfied" Votes264
Total "Not Satisfied" Votes70
Total Rank Assessments39
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • user8436785 Avatar
  • Unnamed Avatar
  • kazk Avatar
  • JohanWiltink Avatar
  • adrian.eyre Avatar
  • wneumann Avatar
  • Madjosz Avatar
  • rowcased Avatar
  • FArekkusu Avatar
  • monadius Avatar
  • hobovsky Avatar
  • Technetium_Phenol Avatar
  • Kacarott Avatar
  • KayleighWasTaken Avatar
Ad