7 kyu
Is my string repeating the same character over and over ?
810 of 813ben8p
Description:
Your task is very simple:
Write a function hasOneChar
returning:
true
if the given string contains the same character repeated all along the stringfalse
otherwise.
For instance:
hasOneChar('aaaaa'); //true
hasOneChar('aaaab'); //false
hasOneChar('bbbbb'); //true
hasOneChar('bbabb'); //false
Of course, what comes in mind first is a loop. But the purpose of this Kata is to test your creativity.
You have to achieve it without using any loops.
Corner cases: the function hasOneChar
should return true
if the string contains one single character.
Be creative!
Logic
Fundamentals
Similar Kata:
Stats:
Created | Dec 13, 2016 |
Published | Dec 13, 2016 |
Warriors Trained | 1446 |
Total Skips | 20 |
Total Code Submissions | 4665 |
Total Times Completed | 813 |
JavaScript Completions | 810 |
CoffeeScript Completions | 22 |
Total Stars | 10 |
% of votes with a positive feedback rating | 86% of 224 |
Total "Very Satisfied" Votes | 175 |
Total "Somewhat Satisfied" Votes | 35 |
Total "Not Satisfied" Votes | 14 |
Total Rank Assessments | 17 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |