6 kyu
Message Validator
299 of 3,754frkn2076
Description:
In this kata, you have an input string and you should check whether it is a valid message. To decide that, you need to split the string by the numbers, and then compare the numbers with the number of characters in the following substring.
For example "3hey5hello2hi"
should be split into 3, hey, 5, hello, 2, hi
and the function should return true
, because "hey"
is 3 characters, "hello"
is 5, and "hi"
is 2; as the numbers and the character counts match, the result is true
.
Notes:
- Messages are composed of only letters and digits
- Numbers may have multiple digits: e.g.
"4code13hellocodewars"
is a valid message - Every number must match the number of character in the following substring, otherwise the message is invalid: e.g.
"hello5"
and"2hi2"
are invalid - If the message is an empty string, you should return
true
Algorithms
Similar Kata:
Stats:
Created | Dec 2, 2020 |
Published | Dec 2, 2020 |
Warriors Trained | 7951 |
Total Skips | 199 |
Total Code Submissions | 27725 |
Total Times Completed | 3754 |
C# Completions | 299 |
JavaScript Completions | 1412 |
Python Completions | 1234 |
Ruby Completions | 96 |
Julia Completions | 14 |
Swift Completions | 107 |
Java Completions | 551 |
Rust Completions | 70 |
Haskell Completions | 38 |
Clojure Completions | 14 |
C Completions | 59 |
Lua Completions | 8 |
Total Stars | 157 |
% of votes with a positive feedback rating | 92% of 585 |
Total "Very Satisfied" Votes | 510 |
Total "Somewhat Satisfied" Votes | 60 |
Total "Not Satisfied" Votes | 15 |
Total Rank Assessments | 36 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 1 kyu |
Lowest Assessed Rank | 8 kyu |