1.简述:
给你一个整数n,找出从1到n各个整数的 Fizz Buzz 表示,并用字符串数组answer(下标从 1 开始)返回结果,其中:
answer[i] == “FizzBuzz”如果i同时是3和5的倍数。
answer[i] == “Fizz”如果i是3的倍数。
answer[i] == “Buzz”如果i是5的倍数。
answer[i] == i(以字符串形式)如果上述条件全不满足。
示例 1:
输入:n = 3
输出:["1","2","Fizz"]
示例 2:
输入:n = 5
输出:["1","2","Fizz","4","Buzz"]
示例 3:
输入:n = 15
输出:["1","2","Fiz服务器托管网z","4","Buzz","Fizz","7","8","Fizz","Buzz","11","Fizz","13","14","FizzBuzz"]
2.代码实现:
class Solution {
public List fizzBuzz(int n) 服务器托管网{
List answer = new ArrayList();
for (int i = 1; i
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: Android 当系统存在多个Launcher时,如何设置开机自动进入默认的Launcher?
以设置Google Launcher2作为默认启动的Launcher为例, 其package name 为 com.android.launcher launcher activity name 为 com.android.launcher2.Launcher…