Western Digital Interview Question
35 Interview Reviews |
Back to all Western Digital Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Senior Software Engineer at Western Digital:
How would you count the number of bits that are set to 1 in a binary number?
| Tags: | technical, programming, brainteaser See more , See less 8 |
See more for this Western Digital Senior Software Engineer Interview
Helpful Question?
Yes |
No
Inappropriate?
1 of 1 people found this helpful
by Interview Candidate:
1. A combination of looping, bitwise & and shifting, counting the ones as you go
2. Create a table of all the possible values for a byte, use this table and each byte of the number to lookup the value and sum.
1 is better when space constraints are tight, 2 is better when time constraints are more important.