LeetCode Top Interview Questions 412. Fizz Buzz (Java版; Easy)
welcome to my blog LeetCode Top Interview Questions 412. Fizz Buzz (Java版; Easy) 题目描述 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" ] 第一次做; 不需要取余操作, 核心: 理解a是b的因数这句话意味着什么 //a是b的因数, 说明b里面有x个a, 也就是让x个a相加便能得到b class Solution { public List < String >