LeetCode—868. Binary Gap


//url:https://leetcode.com/problems/binary-gap/description/
class Solution {
public:
    int binaryGap(int N) {
        int x=1;
        int sum=x;
        int findIndex=-1;
        int index=1;
        if(N&x){
            findIndex=index;
        }
        int maxDistance=0;
        while(sum(index-findIndex)?maxDistance:(index-findIndex);
                    findIndex=index;
                }
            }
        }
        
        return maxDistance;
    }
};


发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注