Ad
  • Custom User Avatar

    I took one of the test cases and mapped it out (breaking out the numbers I knew from the sample). This is what I determined. The first part of the code is a number of zeroes, in sequence, one less than the number of digits used to represent the original decimal integer in binary, then followed by the digit 1. The second half of the code is the original integer in binary. eg. 4 in binary is 100. This is 3 digits. k-2 gives you 2 Zeroes, then followed by a 1. then followed by the number in binary. thus, 4 => 001100. Hope this helps.