Skip to content

Latest commit

 

History

History

encode-number

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

< Previous                  Next >

Given a non-negative integer num, Return its encoding string.

The encoding is done by converting the integer to a string using a secret function that you should deduce from the following table:

 

Example 1:

Input: num = 23
Output: "1000"

Example 2:

Input: num = 107
Output: "101100"

 

Constraints:

  • 0 <= num <= 10^9

Related Topics

[Bit Manipulation] [Math]

Similar Questions

  1. Convert to Base -2 (Medium)

Hints

Hint 1 Try to find the number of binary digits returned by the function.
Hint 2 The pattern is to start counting from zero after determining the number of binary digits.