Category: bit hacks
Your task is to Calculate the sum of two integers a and b without using the operator + and -. Bit Manipulation Integers represent in binary consists of bits …
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, the 32-bit integer ’11′ …
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000). Follow up: If …
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and …
Given an integer, write a function to determine if it is a power of two. This is not new, and the solution has been posted at Using a Faster …