로딩
요청 처리 중입니다...

JAVA_Binary Gap_LeetCode 868

 JAVA_Binary Gap_LeetCode 868

JAVA_Binary Gap_LeetCode 868 풀이 class Solution { public int binaryGap(int n) { int res = 0, cnt = -32; while(n > 0){ if(n % 2 == 1){ res = Math.max(res,cnt); cnt = 0; } cnt++; n = n / 2; } return res; } } * 출처 Binary Gap - LeetCode Can you solve this real interview question? Binary Gap - 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...

# BinaryGap_LeetCode868 # JAVA # JAVA_BinaryGap # JAVA_BinaryGap_LeetCode868 # JAVA_LeetCode868