6 kyu
Bijective Binary
59 of 230Ian T
Description:
Create methods to convert between Bijective Binary strings and integers and back.
A bijective binary number is represented by a string composed only of the characters 1 and 2. Positions have the same value as in binary numbers, a string of repeated 1's has the same value in binary and bijective binary. As there is no symbol for zero it is represented by an empty string.
Every non negative integer has a unique representation unlike binary where 1 = 0001.
https://en.wikipedia.org/wiki/Bijective_numeration
0 = ""
1 = "1"
2 = "2"
3 = "11"
4 = "12"
5 = "21"
6 = "22"
Algorithms
Similar Kata:
Stats:
Created | Apr 18, 2017 |
Published | Apr 18, 2017 |
Warriors Trained | 1089 |
Total Skips | 70 |
Total Code Submissions | 1359 |
Total Times Completed | 230 |
C# Completions | 59 |
JavaScript Completions | 83 |
Haskell Completions | 22 |
Elixir Completions | 9 |
Python Completions | 66 |
C Completions | 14 |
Total Stars | 34 |
% of votes with a positive feedback rating | 96% of 81 |
Total "Very Satisfied" Votes | 75 |
Total "Somewhat Satisfied" Votes | 6 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |