Binary Gap Problem

Binary Gap Problem — ExecCode Easy DSA Practice

Solve the Binary Gap problem on ExecCode. Free online easy DSA practice in Bit Manipulation. Write and run code in Java, C++, Python — no signup required to run.

Description Given a positive integer n, find and return the longest distance between any two adjacent 1 's in the binary representation of n . If there are no two adjacent 1 's, return 0 . Two 1's are adjacent if there are only 0's separating them (possibly no 0's). The distance…

Practice Binary Gap free on ExecCode. Browse more ExecCode DSA problems.