mediumMath 0 views

Convert to Base -2

Given an integer n, return a binary string representing its representation in base -2.

Given an integer n, return a binary string representing its representation in base -2.

Note that the returned string should not have leading zeros unless the string is "0".

Example 1

Input: n = 2

Output: "110"

Example 2

Input: n = 3

Output: "111"

Example 3

Input: n = 4

Output: "100"

Constraints

  • 0 <= n <= 10^9

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.