Write a program that outputs the string representation of numbers from 1 to n.

But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five output “FizzBuzz”.

Example:

n = 15,

Return:
[
    "1",
    "2",
    "Fizz",
    "4",
    "Buzz",
    "Fizz",
    "7",
    "8",
    "Fizz",
    "Buzz",
    "11",
    "Fizz",
    "13",
    "14",
    "FizzBuzz"
]


Seen this question in a real interview before?  No

Thanks for your feedback.

思路:题目不难,难在注意int与str之间的转变


leetcode 412[easy]---Fizz Buzz

相关文章:

  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-01
  • 2021-07-31
  • 2021-10-19
  • 2022-12-23
  • 2022-01-27
  • 2022-01-19
相关资源
相似解决方案