6 kyu
Decoded String by the Numbers
94 of 347Omnilord
Description:
This is a simple string decoding algorithm. The idea is to take a string of characters and decode it into an array. Each character is a single element in the result unless a backslash followed by a positive number is encountered.
When a backslash followed by a positive number is found, the number indicates how many of the next characters are grouped together as one element.
Example:
"abc\5defghi\2jkl" => [ "a", "b", "c", "defgh", "i", "jk", "l" ]
If the number is larger than the count of remaining characters, treat it as reading the remaining characters.
If you are reading characters, and you find an escape inside a string, they should be tallied into the string:
"\5ab\3cde" => [ "ab\3c", "d", "e" ]
Algorithms
Similar Kata:
Stats:
Created | Oct 25, 2015 |
Published | Oct 25, 2015 |
Warriors Trained | 1142 |
Total Skips | 28 |
Total Code Submissions | 3723 |
Total Times Completed | 347 |
JavaScript Completions | 236 |
Haskell Completions | 21 |
Julia Completions | 9 |
Python Completions | 94 |
Total Stars | 36 |
% of votes with a positive feedback rating | 90% of 108 |
Total "Very Satisfied" Votes | 91 |
Total "Somewhat Satisfied" Votes | 13 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 13 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |