Problem · Math
FizzBuzz Problem
Learn this problemProblem statement
When given a number N, for each integer i in the range from 1 to N inclusive, print one value per line as follows:
i is a multiple of both 3 and 5, print "FizzBuzz".i is a multiple of 3 but not 5, print "Fizz".i is a multiple of 5 but not 3, print "Buzz".i is not a multiple of 3 or 5, print the value of i.Write an algorithm which follows the given instructions and prints the required output.
Problem-solving restrictions: 0 < N < 2*10^6
Input description:
The input consists of an integer - inputNum, representing the given number (N).
Output description:
Print a line-separated output based on the given instructions for each value i in the set {1, 2, ... N} in ascending order.
Function
fizzBuzz(inputNum: int) → String[]Examples
Example 1
inputNum = 5return = ["1", "2", "Fizz", "4", "Buzz"]Explanation should be very intuitive to us. Ace and Cheers~~ 🍻
Constraints
0 < N < 2*10^6More Cisco problems
- Longest Non-Repeating SubstringPHONE SCREEN · Seen Jul 2026
- Collect CoinsOA · Seen Jun 2025
- Find Largest Sum Contiguous SubarrayOA · Seen May 2025
- Find Largest Sum of Continuous SequenceOA · Seen May 2025
- Find Palindrome Sub-stringOA · Seen May 2025
- Count Numbers with Digit SumOA · Seen Mar 2025
- Maximum Chocolates from Jars (L.C. 198 :)OA · Seen Mar 2025
- Find Elements Largest in Row Smallest in ColumnOA · Seen Mar 2025