Leetcode in Java && Oracle
419 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-11-15_01-17-38.png
32.5 KB
#N868. Binary Gap
problem link

#solution
class Solution {
public int binaryGap(int n) {
int res=0, d=-30;

while(n>0){
if(n%2==1){
res=Math.max(res, d);
d=0;
}
n=n/2;
d++;
}

return res;
}
}