Category: bit hacks
For example, if you want to remove a bit or some bits from a integer (signed or unsigned), you can do this. inline int removeBit(int n, int bit) { …
Remember a couple days ago, we discussed the O(n) and O(n^2) solutions to Single Number ? Question: Given an array of integers, every element appears three times except for one. Find …
Well, I have a detailed post that presents two solutions to solve the classic n-queen problem. The problem asks you to find the number of solutions to put n queens in …
October 14, 2012
algorithms, beginner, bit hacks, brute force, implementation, interview questions, math, programming languages, python, tricks
Q: n is a none-negative numbers, in order to let divides perfectly 7, characterise n. A: in binary representation is n ones. And 7 in binary is 111. The …
github: https://github.com/DoctorLai/Algorithms/tree/master/Queen n Queen problem can be dated back in 1848. Later, it was popular used in computer algorithm books that teach data structure and algorithms. The problem is to …