Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
B-Nasty
May 25, 2005

smackfu posted:

I feel step 2 of the interview should be "ok, how would you refactor that code so that someone who doesn't know bit wise operators could understand it?"

Which is where my brain went right away after being primed with FizzBuzz solutions. In pseudo code:

code:
int input = XXX;
int count =0;
for(int i = 31; i >= 0; i--){

  int powerOf2 = 2^i;

 if(input % powerOf2 == 0){
    count++;
    input -= powerOf2;
  }
}

Adbot
ADBOT LOVES YOU

B-Nasty
May 25, 2005

Cuntpunch posted:

It looked ROUGHLY like:

At least you got something almost resembling a (in)correct answer. I once asked a candidate to write a few basic statistical functions (mean, median) -- and I provided the formula -- with some unit tests. In 45+ minutes, there wasn't a program that would compile or even the basic start of a correct function.

This was a guy who sounded pretty convincing and confident during the high-level-talking stage. Once keys hit keyboard, that confidence just completely evaporated.

  • Locked thread