FastPrepFizzBuzz
Problems/FizzBuzz

FizzBuzz

Capital One logoCapital One● EasyNEW GRADFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Three Capital One reports name FizzBuzz as a question in an online coding test: two from London graduate programs (December 2015 and October 2020) and one from a 2016 full-time process in Toronto.

None of them gives the input, the output form or limits. In this version the output has exactly n entries, counting up from 1, and n is capped at 3000. These are our choices.

Our version is about 95% the same as the reported questions.

For every whole number i from 1 to n, produce one string:

  • "FizzBuzz" if i is divisible by both 3 and 5;
  • "Fizz" if i is divisible by 3 but not by 5;
  • "Buzz" if i is divisible by 5 but not by 3;
  • the decimal digits of i otherwise.

Return the n strings in order, starting with the one for 1.

Function

fizzBuzz(n: int) → List<String>

Examples

Example 1

n = 20return = ["1","2","Fizz","4","Buzz","Fizz","7","8","Fizz","Buzz","11","Fizz","13","14","FizzBuzz","16","17","Fizz","19","Buzz"]

Nine of the twenty entries turn into words. "Fizz" sits at 3, 6, 9, 12 and 18, "Buzz" at 5, 10 and 20, and 15, which both 3 and 5 divide, gets "FizzBuzz". The other eleven entries stay as plain numbers.

Example 2

n = 4return = ["1","2","Fizz","4"]

Only 3 is divisible by 3, so it is the one word. The list ends before 5, so there is no "Buzz" yet.

Example 3

n = 9return = ["1","2","Fizz","4","Buzz","Fizz","7","8","Fizz"]

The list stops at 9, well before 15, the first number divisible by 15, so no "FizzBuzz" appears.

Constraints

  • 1 <= n <= 3000

More Capital One Online Assessment questions

  • Rank Football TeamsOA · Seen Oct 2026
  • Count Subarrays Matching a Comparison PatternOA · Seen Oct 2026
  • Arithmetic Triplets After QueriesOA · Seen Oct 2026
  • Branch with the Most FilesOA · Seen Oct 2026
  • Count One-Swap Number PairsOA · Seen Oct 2026
  • Distinct Values on Maximum-Sum FramesOA · Seen Oct 2026
  • Earliest Meeting Time for All EmployeesOA · Seen Oct 2026
  • Earn the Most 🐝OA · Seen Oct 2026
  • Sort Adjacent PairsOA · Seen Oct 2026
  • Bouncing Diagonal WeightsOA · Seen Oct 2026

Similar questions at other companies

  • Get Max DeletionsJP Morgan Chase · OAJP Morgan Chase interview questions
  • FizzBuzzIndeed · OAIndeed interview questions
  • Robot Path That Repeats ForeverOpenAI · OAOpenAI interview questions
  • Find Last CharacterGoogle · OAGoogle interview questions
  • Count Prioritized Binary-Run OperationsZipRecruiter · OAZipRecruiter interview questions
  • Flip Rows and Columns, Count ZerosNutanix · OANutanix interview questions
  • 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

Capital One interview experiences

  • Capital One Coding OA Questions: 3 Experiences
  • Capital One Experienced Engineer Power Day and OA: 6 Experiences
  • Capital One New Grad OA Questions: 14 Experiences (Part 2 of 2)
  • Capital One TDP Agentic Round (AI Coding): 7 Experiences
  • Capital One SWE Power Day, Level Not Reported: 6 Experiences
  • Capital One TIP Intern OA and Power Day: 13 Experiences
All Capital One interview questionsSee Capital One hiring insights
Saved
class Solution {
    public List<String> fizzBuzz(int n) {
        // Write your code here.
    }
}
Checking account…