Write a function to calculate the Hamming weight of an integer. (Kernighan method) — int countSetBits(int n) { int count = 0; while (n) { n = n & (n - 1); ++count; } return count; }
G
1.2K
Google Interview
This flashcard deck made by jwasham contains knowledge about google interview. For more details, please follow https://github.com/jwasham/google-interview-university