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:

CreatedApr 18, 2017
PublishedApr 18, 2017
Warriors Trained1089
Total Skips70
Total Code Submissions1359
Total Times Completed230
C# Completions59
JavaScript Completions83
Haskell Completions22
Elixir Completions9
Python Completions66
C Completions14
Total Stars34
% of votes with a positive feedback rating96% of 81
Total "Very Satisfied" Votes75
Total "Somewhat Satisfied" Votes6
Total "Not Satisfied" Votes0
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Ian T Avatar
  • docgunthrop Avatar
  • JohanWiltink Avatar
  • KataSideKick Avatar
  • trashy_incel Avatar
Ad