number in -2 (minus two) bases

Revision en2, by ndatta, 2015-10-17 10:49:04

Given a number in base -2 in binary form. return negative of that number in base -2 in binary form. Given [1,0,0,1,1,1] => return [1,1,0,1,0,1,1]. [1,0,0,1,1,1] = -23 (from left) , neg(-23) = 23 in base -2, 23 is [1,1,0,1,0,1,1]. Length of the given array <= 10^5

Any idea? Thanks in advance.

Tags math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English ndatta 2015-10-17 10:49:04 4
en1 English ndatta 2015-10-17 10:48:01 327 Initial revision (published)