For i = [1 ... n], print i, but if i is divisible by 3, print "fizz"; if i is divisible by 5, print "buzz"; if i is divisible by both 3 and 5, print "fizz buzz".

Example

When n = 15, return:

[
  "1",      "2",        "fizz",
  "4",      "buzz",     "fizz",
  "7",      "8",        "fizz",
  "buzz",   "11",       "fizz",
  "13",     "14",       "fizz buzz"
]
class Solution {
    /**
     * param n: As description.
     * return: A list of strings.
     */
    public ArrayList<String> fizzBuzz(int n) {
        ArrayList<String> results = new ArrayList<String>();
        for (int i = 1; i <= n; i++) {
            if (i % 15 == 0) {
                results.add("fizz buzz");
            } else if (i % 5 == 0) {
                results.add("buzz");
            } else if (i % 3 == 0) {
                results.add("fizz");
            } else {
                results.add(String.valueOf(i));
            }
        }
        return results;
    }
}