Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you've been coding for 5 years, you should be able to write FizzBuzz on a board (or in this case actually on a computer) without the use of Google.

I agree that whtieboard interviews aren't good indicators of programming ability, and we employ other methods of figuring that out.

But the first test is to write a loop that prints the numbers 1 through 100 in your language of choice.

If you can't do that, you haven't been coding for 5 years.

And of course good programmers use Google. That's not the point.



In Python: [x+1 for x in range(100)] is not a loop but it prints out the numbers 1 to 100 map(lambda x: x+1, range(100)) is also Python and more legible to some people but the former is more idiomatic.

The key to fizzbuzz is to make the decision for a number x, whether to map it to itself or fizz or buzz or fizzbuzz. Given a function which does thatm, just map it over whatever list of integers you want. Still no loop.

Modern functional programming style does not generally write loops; that job is left to the compiler. Python does allow one to write loops, but it is fairly well known that doing so causes your code to run slower because you are fighting against the compiler and the underlying VM.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: