Live data from Hacker News

Fizz Buzz codegolf challenge in 15 languages

hackerrank.com

21–30 of 100 posts

Re: Fizz Buzz codegolf challenge in 15 languages

#21
post #11

seems to be dead ... wonder if they are running the code submitted on the webserver & people have submitted busy loops or somesuch

Hi, can you check now. It is working. We run it in our codecheckers and not on webservers.

Cool, much faster now :)

Re: Fizz Buzz codegolf challenge in 15 languages

#22

Earlier quoted context omitted.

I'm wondering the same thing...

`console.log` works fine.

What is wrong with this then (not my entry):

    process.stdin.resume();
    process.stdin.setEncoding("ascii");
    process.stdin.on("data", function (input) {
        var output = ''
        if (input % 3 === 0){
            output += 'Fizz'
        }
        if (input % 5 === 0){
            output += 'Buzz'
        }
        console.log(output || input)
    });
Testing locally with

    for(i=1;i
gives the correct results.

Re: Fizz Buzz codegolf challenge in 15 languages

#23

I don't understand why this only gets a score of 1: static String[] c = { "", "FizzBuzz", "Buzz", "Fizz" }; public static void main(String[] args) { for(int i = 1; i

Because it's huge and this is a code golf challenge?

=\ No point in trying with Java then?

Re: Fizz Buzz codegolf challenge in 15 languages

#25
Bit confused by the ruby version. The signature you're given is:

    #!/bin/ruby

    # Head ends here
    def fizzbuzz_solve n

    end

    # Tail starts here 
I presumed this meant you were supposed to return a value of n, fizz, buzz or fizzbuzz for the value of n. When I tried to compile I got a score of 0 though. What are you supposed to do with the value of n, solve fizzbuzz for 1..n ?

Re: Fizz Buzz codegolf challenge in 15 languages

#26

It seems like an neat idea! But I'm not I'm sure if I would make whitespace count as characters. Seem like that punishes good formatting. I also scored 56.00000000000001 :D (I tried the Perl one)

118 for my PHP solution, will try and check if my Python skills can beat it.. btw I am not able to login and getting too many error .. HN effect ?

Re: Fizz Buzz codegolf challenge in 15 languages

#27
post #25

Bit confused by the ruby version. The signature you're given is: #!/bin/ruby # Head ends here def fizzbuzz_solve n end # Tail starts here I presumed this meant you were supposed to return a value of n, fizz, buzz or fizzbuzz for the value of n. When I tried to compile I got a score of 0 though. What are you supposed to do with the value of n, solve fizzbuzz for 1..n ?

In other languages n is the number between 1-100 passed into the method. The loop is outside of fizzbuzz_solve.

Re: Fizz Buzz codegolf challenge in 15 languages

#28
post #26

It seems like an neat idea! But I'm not I'm sure if I would make whitespace count as characters. Seem like that punishes good formatting. I also scored 56.00000000000001 :D (I tried the Perl one)

118 for my PHP solution, will try and check if my Python skills can beat it.. btw I am not able to login and getting too many error .. HN effect ?

Yes, fixing it. Can you try?

Re: Fizz Buzz codegolf challenge in 15 languages

#29
post #25

Bit confused by the ruby version. The signature you're given is: #!/bin/ruby # Head ends here def fizzbuzz_solve n end # Tail starts here I presumed this meant you were supposed to return a value of n, fizz, buzz or fizzbuzz for the value of n. When I tried to compile I got a score of 0 though. What are you supposed to do with the value of n, solve fizzbuzz for 1..n ?

In other languages n is the number between 1-100 passed into the method. The loop is outside of fizzbuzz_solve.

I presumed you just return the value and that the print was in the outer loop, seems you need to include the print statement in your method.

Re: Fizz Buzz codegolf challenge in 15 languages

#30
post #25

Bit confused by the ruby version. The signature you're given is: #!/bin/ruby # Head ends here def fizzbuzz_solve n end # Tail starts here I presumed this meant you were supposed to return a value of n, fizz, buzz or fizzbuzz for the value of n. When I tried to compile I got a score of 0 though. What are you supposed to do with the value of n, solve fizzbuzz for 1..n ?

The boilerplate (include the shebang) counts towards your score, so just ditch it and start anew.
Post reply on HN