← Infosys questions

Convert a number to negative base 2

Filed under Infosys

Given an integer n, return its binary representation in base -2 (negabinary) as a string. In base -2, digits are 0 or 1, and the value is the sum of digits multiplied by (-2) raised to their…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Infosys questions

Collected from public candidate posts and coding forums. Updated Nov 2026.