Live data from Hacker News

Fizz Buzz codegolf challenge in 15 languages

hackerrank.com

11–20 of 100 posts

Re: Fizz Buzz codegolf challenge in 15 languages

#12
post #3

The obvious scala implementation is 160 chars and works locally, but the site claims I score 0 for it: object Solution {def main(args: Array[String])=1 to 100 map {x=>System.out.print(if(x%3>0&&x%5>0)x else if(x%5>0)"Buzz" else if(x%3>0)"Fizz" else "FizzBuzz")}}

you are missing out new line characters after each output. `System.out.println` should work.

Re: Fizz Buzz codegolf challenge in 15 languages

#13
post #3

The obvious scala implementation is 160 chars and works locally, but the site claims I score 0 for it: object Solution {def main(args: Array[String])=1 to 100 map {x=>System.out.print(if(x%3>0&&x%5>0)x else if(x%5>0)"Buzz" else if(x%3>0)"Fizz" else "FizzBuzz")}}

[deleted]

Re: Fizz Buzz codegolf challenge in 15 languages

#14
post #3

The obvious scala implementation is 160 chars and works locally, but the site claims I score 0 for it: object Solution {def main(args: Array[String])=1 to 100 map {x=>System.out.print(if(x%3>0&&x%5>0)x else if(x%5>0)"Buzz" else if(x%3>0)"Fizz" else "FizzBuzz")}}

When I tried out the site, it gave me a score of 0 for submissions that compiled but produced the wrong output.

I've never written scala before but it looks like your logic is wrong.

Edit: I tweaked your code and got a score of 34

   object Solution {def main(args: Array[String])=1 to 100 map {x=>System.out.println(if(x%3==0&&x%5==0)"FizzBuzz" else if(x%5==0)"Buzz" else if(x%3==0)"Fizz" else x)}}

Re: Fizz Buzz codegolf challenge in 15 languages

#20

How do you get javascript to work? I tried `process.stdout.write`, `console.log`, but the score is always zero. Other issues: - The "Solve FizzBuzz" button doesn't go anywhere if you are logged in, neither does "The Scenario" up top. - Forum doesn't work (please fill in all the required fields - they already are) - Signout link doesn't work

I'm wondering the same thing...

`console.log` works fine.
Post reply on HN