Search
⌘K

Leetcode 1017. Convert to Base -2

Convert a nonnegative integer n (0 ≤ n ≤ 10^9) into its base -2 (negabinary) representation as a binary string with no leading zeros (except "0"). The core challenge is computing digits for a negative base, i.e., repeatedly dividing and adjusting remainders so each digit is 0 or 1.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.