FastPrepFizzBuzz With Bubble and Scream
Problems/FizzBuzz With Bubble and Scream

FizzBuzz With Bubble and Scream

Zillow logoZillow● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported at Zillow by a candidate for a Software Engineer Entry Level role in the United States who interviewed in March 2016, rated the experience neutral, and did not get an offer. The interview was a half-hour, in-person meeting with one question, followed by a conversation; the candidate says they learned a little about the company's culture.

The question was a FizzBuzz-style task with other words: multiples of 3 map to Bubble, multiples of 5 to Scream, and the combined case to Bubble Scream. The report's wording for the combined case reads as if either divisor were enough; we take it to mean numbers divisible by both 3 and 5, because the two rules before it already cover numbers divisible by just one of them.

The report does not say which numbers to go through or what to write for a number that matches no rule. Our choices: the function bubbleScream gets n and returns a list of n strings for the numbers 1 to n, and a number that matches no rule is written as itself in decimal. The limit (n from 1 to 1,000) is ours as well. The interview asked to print the words; here the function returns them as a list.

The report does not call this interview a phone screen or an onsite round. It was one short interview with nothing marking it as a final round, so we list it as a phone screen, our default for such reports.

Our version is about 90% the same as the reported question.

Given an integer n, go through the numbers from 1 to n in order and turn each number i into one string:

  • "Bubble Scream" if i is divisible by both 3 and 5;
  • "Bubble" if i is divisible by 3 but not by 5;
  • "Scream" if i is divisible by 5 but not by 3;
  • otherwise, i itself written in decimal, for example "7".

Return the n strings as a list, in order from 1 to n.

The two words in "Bubble Scream" are separated by a single space, and every word starts with a capital letter.

Function

bubbleScream(n: int) → List<String>

Examples

Example 1

n = 15return = ["1","2","Bubble","4","Scream","Bubble","7","8","Bubble","Scream","11","Bubble","13","14","Bubble Scream"]

3, 6, 9 and 12 are divisible by 3 but not by 5, so they become "Bubble". 5 and 10 are divisible by 5 but not by 3, so they become "Scream". 15 is divisible by both 3 and 5, so it becomes "Bubble Scream". The other eight numbers are written as themselves.

Example 2

n = 5return = ["1","2","Bubble","4","Scream"]

3 becomes "Bubble" and 5 becomes "Scream". No number up to 5 is divisible by both 3 and 5, so "Bubble Scream" does not appear.

Example 3

n = 1return = ["1"]

1 is not divisible by 3 or by 5, so the list holds just "1".

Constraints

  • 1 <= n <= 1000

More Zillow Phone Screen questions

  • Valid ParenthesesPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2025
  • Time Based Key-Value StorePHONE SCREEN · Seen Feb 2024
  • Filter Formatted Records by CriteriaPHONE SCREEN · Seen Sep 2023
  • Build a Hash TablePHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2023
  • Jump GamePHONE SCREEN · Seen Dec 2022
  • Reversible Run-Length EncodingPHONE SCREEN · Seen Nov 2022
  • Spiral MatrixPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2022
  • Two Sum: All PairsPHONE SCREEN · Seen Nov 2022
  • Employee Free TimePHONE SCREEN · Seen Oct 2022
  • First Unique Character in a StringPHONE SCREEN · Seen Oct 2022

Similar questions at other companies

  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Add Two Integers Given as StringsJane Street · PHONE SCREENJane Street interview questions
  • Fizz and Buzz Words From 1 to nDocuSign · PHONE SCREENDocuSign interview questions
  • Fizz BuzzBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Double-Base PalindromesxAI · PHONE SCREENxAI interview questions
  • Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
  • Per-Segment SpeedingOnePay · PHONE SCREENOnePay interview questions
  • Add Decimal Strings ExactlyMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Format a Centered Pagination BarMixpanel · PHONE SCREENMixpanel interview questions
All Zillow interview questionsSee Zillow hiring insights
Saved
class Solution {
    public List<String> bubbleScream(int n) {
        // Write your code here.
    }
}
Checking account…