An error occurred:
Rebuild failed: Renaming tempfile 'C:\codinghorror\blog\archives\000781.html.new' failed: Renaming 'C:\codinghorror\blog\archives\000781.html.new' to 'C:\codinghorror\blog\archives\000781.html' failed: Permission denied
Shortly after that, the site just went to hell and the pages wouldn't even come up, or they would only come up half way. It should be interesting to read what happened to Jeff's site; hardware failure, database corruption, massive volume, sabotage, etc.
There was a section in Jeff's post where he was quoting another author about this FizzBuzz test. Basically the guy would ask an interviewee to write a loop that would go from 1 to 100. Print the word Fizz every 3, the word Buzz every 5 and the word FizzBuzz every 15, and just the number everywhere else.
To Jeff's astonishment people were actually posting solutions to the simple code test. But really, when will a programmer not try to flex his might and show off his skills a bit. However, some people where trying to one up each other and the started to post code that forgot to do parts of the test, like print the number everywhere else or print FizzBuzz every 15 lines.
The author stated that a decent programmer should be able to write the code in under two minutes.
Without further delay, here is the response I wrote but wasn't able to post due to the blog going down:
It's funny to see some of the solutions. I am in no means a "hard core" programmer (I didn't know if VB had a MOD function since I haven't used that since I did Pascal back in college). But it's one of those tests that is so simply you have a chance not to follow the directions.
This took me about a minute to write, if I had more time I would have found out if MOD was better to use. But it covers the requirements: 1) Loop 1 to 100, 2) print FizzBuzz every 15, 3) print Buzz every 5 and 4) print Fizz every 3.
And I would have asked the clarification if they supercede each other or if you would need to print Fizz Buzz FizzBuzz every 15.
Sorry Jeff for posting a solution, but if you can memorize something like this for a job interview, then you can write a loop anyway.
---
'VB6
Const fizz = 3
Const buzz = 5
Const loopEnd = 100
Dim x
For x = 1 To loopEnd
If x / (fizz * buzz) = Round(x / (fizz * buzz), 0) Then
Debug.Print "FizzBuzz"
ElseIf x / buzz = Round(x / buzz, 0) Then
Debug.Print "buzz"
ElseIf x / fizz = Round(x / fizz, 0) Then
Debug.Print "Fizz"
Else
Debug.Print x
End If
Next