Binary Gap

A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.

In order to make code of finding out the binary gap of integer ‘N’, first of all we need to exchange from integer N to binary representation.

Read More