File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 35
35
]*/
36
36
public class _412 {
37
37
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
+ }
49
51
}
52
+ return result ;
50
53
}
51
- return result ;
52
54
}
53
-
54
55
}
You can’t perform that action at this time.
0 commit comments