Skip to content

Commit 38753de

Browse files
refactor 412
1 parent 44b2ef2 commit 38753de

File tree

1 file changed

+14
-13
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+14
-13
lines changed

src/main/java/com/fishercoder/solutions/_412.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,21 @@
3535
]*/
3636
public class _412 {
3737

38-
public List<String> fizzBuzz(int n) {
39-
List<String> result = new ArrayList();
40-
for (int i = 1; i <= n; i++) {
41-
if (i % 3 == 0 && i % 5 == 0) {
42-
result.add("_412");
43-
} else if (i % 3 == 0) {
44-
result.add("Fizz");
45-
} else if (i % 5 == 0) {
46-
result.add("Buzz");
47-
} else {
48-
result.add(Integer.toString(i));
38+
public static class Solution1 {
39+
public List<String> fizzBuzz(int n) {
40+
List<String> result = new ArrayList();
41+
for (int i = 1; i <= n; i++) {
42+
if (i % 3 == 0 && i % 5 == 0) {
43+
result.add("_412");
44+
} else if (i % 3 == 0) {
45+
result.add("Fizz");
46+
} else if (i % 5 == 0) {
47+
result.add("Buzz");
48+
} else {
49+
result.add(Integer.toString(i));
50+
}
4951
}
52+
return result;
5053
}
51-
return result;
5254
}
53-
5455
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy