Re:Interview Zen, tool for asynchronous coding interviews
by lifeisstillgood on Thursday September 13, 2012 @11:14AM
(#4516540)
I am a bit lost on the syntax, but its always good to check for division by 15 first. You have sort of caught that I think in 5 and not 3, but that just seems an odd idiom.
The homepage shows a simple example in C.
Oh, I used to use this on coding tests, the first guy who asked can I do it recursively in Scheme - I could have kissed him !
Re:Interview Zen, tool for asynchronous coding interviews
by PhearTheCeal on Thursday September 13, 2012 @12:54PM
(#4517221)
My python solution:
print "\n".join(["Fizz"*(i%3==0)+"Buzz"*(i%5==0)+str(i)*(i%5!=0 and i%3!=0) for i in range(1,101)])
<?php
$x = 1;
while($x <= 100) {
if((($x % 5) == 0) && (($x % 3) != 0)){ print("Buzz"); }else{ if(($x % 3) == 0){ if(($x % 5) == 0) { print("FizzBuzz"); } else { print("Fizz"); } }else{ print($x); }} ++$x; }
?>