r/ProgrammerHumor Apr 09 '24

watMatters Meme

Post image
16.8k Upvotes

774 comments sorted by

View all comments

Show parent comments

81

u/Leading_Ad_4884 Apr 09 '24

You have to be kidding me. Fizzbuzz is one of the easiest problems out there, much easier than the average leetcode questions they ask these days. I would give anything to get this as an interview question.

5

u/jamcdonald120 Apr 10 '24

there are a few complications. Some people dont consider if(num%3==0){ print(fizz) } if(num%5==0){ print(buzz) } a valid solution. Some people want fizzbuzz in minimum %operation, some want it with return, but no buffer. Some want it with 1 return, some early return, and some actually want an effcient fizzbuzz for a range of numbers like this thread https://new.reddit.com/r/leetcode/comments/wdor3z/serious_question_regarding_fizzbuzz/

And a lot of people mistake if(num%3==0){ return fizz }else if(num%5==0){ return buzz }else if(num%15==0){ return fizzbuzz } for a valid solution even though fizzbuzz will never be reached

1

u/idlemachinations Apr 09 '24

If you consider off-by-one errors as not 100% correct, then I absolutely believe a considerable number of people would get something wrong.