File tree 2 files changed +11
-7
lines changed
main/java/com/fishercoder/solutions
test/java/com/fishercoder
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
3
/**
4
+ * 504. Base 7
5
+ *
4
6
* Given an integer, return its base 7 string representation.
5
-
6
7
Example 1:
7
8
Input: 100
8
9
Output: "202"
10
+
9
11
Example 2:
10
12
Input: -7
11
13
Output: "-10"
14
16
*/
15
17
public class _504 {
16
18
17
- public String convertToBase7 (int num ) {
18
- return String .valueOf (Integer .toString (num , 7 ));
19
+ public static class Solution1 {
20
+ public String convertToBase7 (int num ) {
21
+ return String .valueOf (Integer .toString (num , 7 ));
22
+ }
19
23
}
20
24
}
Original file line number Diff line number Diff line change 11
11
* Created by fishercoder on 1/15/17.
12
12
*/
13
13
public class _504Test {
14
- private static _504 test ;
14
+ private static _504 . Solution1 solution1 ;
15
15
private static String expected ;
16
16
private static String actual ;
17
17
private static int num ;
18
18
19
19
@ BeforeClass
20
20
public static void setup () {
21
- test = new _504 ();
21
+ solution1 = new _504 . Solution1 ();
22
22
}
23
23
24
24
@ Before
@@ -32,15 +32,15 @@ public void setupForEachTest() {
32
32
public void test1 () {
33
33
num = 100 ;
34
34
expected = "202" ;
35
- actual = test .convertToBase7 (num );
35
+ actual = solution1 .convertToBase7 (num );
36
36
assertEquals (expected , actual );
37
37
}
38
38
39
39
@ Test
40
40
public void test2 () {
41
41
num = -7 ;
42
42
expected = "-10" ;
43
- actual = test .convertToBase7 (num );
43
+ actual = solution1 .convertToBase7 (num );
44
44
assertEquals (expected , actual );
45
45
}
46
46
}
You can’t perform that action at this time.
0 commit comments