Tag: C/C++
Given a 32-bit integer, we want to find out the next highest power of 2. For example, the next power of two for 127 is 128. We can use …
You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may …
Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same …
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. For example, given two integers x=1 and y=4, the hamming distance …
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′ …