4 kyu
Regular expression for binary numbers divisible by 5
722 of 2,260aswitalski
Description:
Define a regular expression which tests if a given string representing a binary number is divisible by 5.
Examples:
// 5 divisable by 5
divisibleByFive.test('101') === true
// 135 divisable by 5
divisibleByFive.test('10000111') === true
// 666 not divisable by 5
divisibleByFive.test('0000001010011010') === false
Note:
This can be solved by creating a Finite State Machine that evaluates if a string representing a number in binary base is divisible by given number.
The detailed explanation for dividing by 3 is here
The FSM diagram for dividing by 5 is here
Binary
Algorithms
Regular Expressions
Similar Kata:
Stats:
Created | Nov 14, 2015 |
Published | Nov 15, 2015 |
Warriors Trained | 13935 |
Total Skips | 5194 |
Total Code Submissions | 14180 |
Total Times Completed | 2260 |
JavaScript Completions | 722 |
Python Completions | 797 |
Java Completions | 450 |
TypeScript Completions | 238 |
PHP Completions | 180 |
C# Completions | 245 |
Total Stars | 361 |
% of votes with a positive feedback rating | 91% of 394 |
Total "Very Satisfied" Votes | 342 |
Total "Somewhat Satisfied" Votes | 35 |
Total "Not Satisfied" Votes | 17 |
Total Rank Assessments | 8 |
Average Assessed Rank | 4 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 5 kyu |