Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 1.97 KB

README.md

File metadata and controls

59 lines (44 loc) · 1.97 KB

< 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

[Math] [String] [Bit Manipulation]

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.