id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

tmhscs@gmail.com logic > logic_fizzBuzz
prev  |  next  |  chance

A famous programming interview problem is the FizzBuzz problem. This is a slightly modified version. Given an integer "num", make a String array of that size. Then, fill it with the Strings "1", "2", "3", "4", ... etc, BUT, whenever you hit a multiple of 3, replace it with "Fizz" and if you hit a multiple of "5" replace it with "Buzz". If the number is a multiple of both 3 and 5, instead replace it with "FizzBuzz". Look at the example inputs and outputs!


logic_fizzBuzz(3) → ["1", "2", "Fizz"]
logic_fizzBuzz(4) → ["1", "2", "Fizz", "4"]
logic_fizzBuzz(5) → ["1", "2", "Fizz", "4", "Buzz"]

...Save, Compile, Run (ctrl-enter)

public String[] logic_fizzBuzz(int num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy