Hudson River Trading OA SWE New Grad

85 minutes C/C++ only.

Minimum length of (-2) base integers.
Given an integer, it can be represented using (-2) base.

Example:
original | (-2) base
-2 | 10
4 | 100
-8 | 1000

Write a function that returns the (-2) base integer and the length of it must be the smallest of all possible representations.

vector<int> convert(int integer)

挂了