PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Uber

Implement FizzBuzz

Last updated: Apr 11, 2026

Quick Overview

This question evaluates basic programming and algorithmic reasoning, including control flow, modular arithmetic, string handling, and the ability to analyze time and space complexity.

  • medium
  • Uber
  • Coding & Algorithms
  • Data Scientist

Implement FizzBuzz

Company: Uber

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Implement the classic **FizzBuzz** problem. Given a positive integer `n`, return the sequence from `1` to `n` as strings with the following rules: - If a number is divisible by `3`, output `"Fizz"` - If a number is divisible by `5`, output `"Buzz"` - If a number is divisible by both `3` and `5`, output `"FizzBuzz"` - Otherwise, output the number itself as a string Example for `n = 15`: `["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"]` Discuss time and space complexity.

Quick Answer: This question evaluates basic programming and algorithmic reasoning, including control flow, modular arithmetic, string handling, and the ability to analyze time and space complexity.

Related Interview Questions

  • Maximize Throughput and Count Trigger Components - Uber (medium)
  • Replace Dashes With Nearest Letters - Uber (medium)
  • Find Earliest Column With One - Uber (easy)
  • Solve Wonderful Strings and Grid Queries - Uber (hard)
  • Count Islands After Land Additions - Uber (medium)
Uber logo
Uber
Mar 22, 2026, 12:00 AM
Data Scientist
Onsite
Coding & Algorithms
2
0
Loading...

Implement the classic FizzBuzz problem.

Given a positive integer n, return the sequence from 1 to n as strings with the following rules:

  • If a number is divisible by 3 , output "Fizz"
  • If a number is divisible by 5 , output "Buzz"
  • If a number is divisible by both 3 and 5 , output "FizzBuzz"
  • Otherwise, output the number itself as a string

Example for n = 15: ["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"]

Discuss time and space complexity.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Uber•More Data Scientist•Uber Data Scientist•Uber Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.