Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary ...
Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example : Example : Example : Example : 这道题让我们判断一个二进制数的 和 是否是交替出现的,博主开 ...
2017-10-19 23:51 2 3049 推荐指数:
Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary ...
Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 二进制数相加,并且保存在string中,要注意的是如何将string ...
Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. ...
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100 ...
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes ...
Reverse bits of a given 32 bits unsigned integer. Example 1: Example 2: Note: Note that in some ...
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example ...
Given a positive integer `N`, find and return the longest distance between two consecutive 1's in the binary representation of `N`. If there aren't ...