In this Kata you must convert integers numbers from and to a negative-base binary system.

Negative-base systems can accommodate all the same numbers as standard place-value systems, but both positive and negative numbers are represented without the use of a minus sign (or, in computer representation, a sign bit); this advantage is countered by an increased complexity of arithmetic operations.

To help understand, the first eight digits (in decimal) of the Base(-2) system is: 

`[1, -2, 4, -8, 16, -32, 64, -128]`


Example conversions:

`Decimal, negabinary`
```
6,   '11010'
-6,  '1110'
4,   '100'
18,  '10110'
-11, '110101'
```

Source: codewars | Difficulty: EASY
Tags: Bit manipulation

Starter code: def int_to_negabinary(i):
	

Solutions:
def int_to_negabinary(i):
	ds = []
	while i != 0:
		ds.append(i & 1)
		i = -(i >> 1)
	return ''.join((str(d) for d in reversed(ds))) if ds else '0'

def negabinary_to_int(s):
	i = 0
	for c in s:
		i = -(i << 1) + int(c)
	return i


def int_to_negabinary(i):
	(i, s) = (-i, '')
	while i:
		(i, r) = divmod(i, -2)
		s += str(-r)
	return s[::-1] or '0'

def negabinary_to_int(s):
	(i, b) = (0, 1)
	for c in s[::-1]:
		i += int(c) * b
		b *= -2
	return i


def int_to_negabinary(i):
	return '{:b}'.format(2863311530 + i ^ 2863311530)

def negabinary_to_int(n):
	return (int(n, 2) ^ 2863311530) - 2863311530


def int_to_negabinary(n):
	return int_to_negabinary(n // -2 + n % 2).lstrip('0') + str(n % 2) if n else '0'

def negabinary_to_int(s):
	return negabinary_to_int(s[:-1]) * -2 + int(s) % 2 if s else 0


def int_to_negabinary(i):
	digits = []
	if not i:
		digits = ['0']
	else:
		while i != 0:
			(i, remainder) = divmod(i, -2)
			if remainder < 0:
				(i, remainder) = (i + 1, remainder + 2)
			digits.append(str(remainder))
	return ''.join(digits[::-1])

def negabinary_to_int(s):
	num = 0
	for c in s:
		num *= -2
		num += '01'.find(c)
	return num


def int_to_negabinary(i):
	if not i:
		return '0'
	digits = []
	while i != 0:
		(i, r) = divmod(i, -2)
		(i, r) = (i + 1, r + 2) if r < 0 else (i, r)
		digits.append(str(r))
	return ''.join(digits[::-1])

def negabinary_to_int(s):
	return sum([int(c) * (-2) ** i for (i, c) in enumerate(s[::-1])])


def int_to_negabinary(i):
	mask = 187649984473770
	return bin(i + mask ^ mask)[2:]

def negabinary_to_int(s):
	mask = 187649984473770
	return (int(s, 2) ^ mask) - mask


def int_to_negabinary(n):

	def do(n1):
		li = []
		while n1 != 0:
			li.append(str(abs(n1 % -2)))
			n1 //= -2
		return li[::-1]
	return ''.join([do(abs(n)), do(-n)][n > 0]) or '0'
negabinary_to_int = lambda n: sum([int(j) * (-2) ** i for (i, j) in enumerate(n[::-1])])


def int_to_negabinary(i):
	return bin(i + 2863311530 ^ 2863311530)[2:]

def negabinary_to_int(s):
	return sum((int(d) * (-2) ** i for (i, d) in enumerate(s[::-1])))


mask = 2863311530

def int_to_negabinary(i):
	return '{0:b}'.format(mask + i ^ mask)

def negabinary_to_int(s):
	return (int(s, 2) ^ mask) - mask