This project describes the solution to a codility programming challenge for position of developer at Microsoft
Given a String representation of a Binary Number N where the length of N is in the range 1-1000000000 ,two actions can be performed on N ,if its odd subtract 1 ,if even divide it by 2. Iterate this operation until N is 0.
Write an "Efficient" function:
class Solution { public int solution(String N); }
that, given a positive integer N, returns the number of operations it requires to get N to 1.
Write an efficient algorithm for the following assumptions:
N is an integer whose binary representation is of length within the range [1..10000000].
- Java 1.8 - Programming Language and Version
- Mark James Kiptubei - Initial work - Kiptubei