前三题都是位运算的知识点。
第一题:https://leetcode.cn/problems/binary-gap/
需要注意:位运算“&”是从右往左进行的,因此第一个if函数体中,在遇到了第一个“1”之后将count清零。
第二题:https://leetcode.cn/problems/number-of-1-bits/
第三题:https://leetcode.cn/problems/single-number/
第四题:https://codeforces.com/contest/1352/problem/C
第四题需要注意c的取值。b的作用是判断k是否为区间长度n-1的整数倍,若为整数倍,则则需往前推一个元素,即a*n+b-1;否则为a*n+b。