r/ProgrammerHumor • • Jan 16 '14

[deleted by user]

[removed]

1.3k Upvotes

446 comments sorted by

View all comments

Show parent comment

1

u/acfman17 Jan 17 '14

I wanted to see how efficiently it can be done in Java and came across this. So complicated for such a simple problem lol.

public String fizzBuzz(int n){
  return (n>0) ? fizzBuzz(n-1) + 
(n % 15 != 0? n % 5 != 0? n % 3 != 0? (n+"") :"Fizz" : "Buzz" : "FizzBuzz"): "";
}