7 kyu

String doubles

97 of 3,064KenKamau

Description:

In this Kata, you will write a function doubles that will remove double string characters that are adjacent to each other.

For example:

doubles('abbcccdddda') = 'aca', because, from left to right:

a) There is only one 'a' on the left hand side, so it stays.
b) The 2 b's disappear because we are removing double characters that are adjacent. 
c) Of the 3 c's, we remove two. We are only removing doubles. 
d) The 4 d's all disappear, because we first remove the first double, and again we remove the second double.
e) There is only one 'a' at the end, so it stays.

Two more examples: doubles('abbbzz') = 'ab' and doubles('abba') = "". In the second example, when we remove the b's in 'abba', the double a that results is then removed.

The strings will contain lowercase letters only. More examples in the test cases.

Good luck!

Strings
Algorithms

Stats:

CreatedNov 21, 2017
PublishedNov 22, 2017
Warriors Trained5918
Total Skips83
Total Code Submissions19022
Total Times Completed3064
Ruby Completions97
Python Completions758
JavaScript Completions1093
C# Completions204
Haskell Completions76
Rust Completions68
C++ Completions858
Clojure Completions12
Total Stars96
% of votes with a positive feedback rating90% of 589
Total "Very Satisfied" Votes496
Total "Somewhat Satisfied" Votes65
Total "Not Satisfied" Votes28
Total Rank Assessments5
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • KenKamau Avatar
  • imjasonmiller Avatar
  • Voile Avatar
  • Souzooka Avatar
  • rsa Avatar
  • FArekkusu Avatar
  • username0 Avatar
  • Captain_Howdy Avatar
  • user8436785 Avatar
  • saudiGuy Avatar
Ad