Skip to content

Commit f083ee8

Browse files
refactor 498
1 parent db4fad2 commit f083ee8

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@
2323
*/
2424
public class _498 {
2525

26-
/**Reference: https://discuss.leetcode.com/topic/77865/concise-java-solution/2
26+
public static class Solutoin1 {
27+
/**
28+
* Reference: https://discuss.leetcode.com/topic/77865/concise-java-solution/2
2729
* Just keep walking the matrix, when hitting the four borders (top, bottom, left or right),
28-
* just directions and keep walking.*/
30+
* just directions and keep walking.
31+
*/
2932
public int[] findDiagonalOrder(int[][] matrix) {
3033

3134
if (matrix == null || matrix.length == 0) {
@@ -62,7 +65,7 @@ public int[] findDiagonalOrder(int[][] matrix) {
6265
}
6366
}
6467
return result;
65-
6668
}
69+
}
6770

6871
}

src/test/java/com/fishercoder/_498Test.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
* Created by fishercoder on 5/26/17.
1111
*/
1212
public class _498Test {
13-
private static _498 test;
13+
private static _498.Solutoin1 solutoin1;
1414
private static int[][] matrix;
1515
private static int[] expected;
1616

1717
@BeforeClass
1818
public static void setup() {
19-
test = new _498();
19+
solutoin1 = new _498.Solutoin1();
2020
}
2121

2222
@Test
@@ -27,7 +27,7 @@ public void test1() {
2727
{7, 8, 9},
2828
};
2929
expected = new int[]{1, 2, 4, 7, 5, 3, 6, 8, 9};
30-
assertArrayEquals(expected, test.findDiagonalOrder(matrix));
30+
assertArrayEquals(expected, solutoin1.findDiagonalOrder(matrix));
3131
}
3232

3333
@Test
@@ -40,6 +40,6 @@ public void test2() {
4040
{13, 14, 15},
4141
};
4242
expected = new int[]{1, 2, 4, 7, 5, 3, 6, 8, 10, 13, 11, 9, 12, 14, 15};
43-
assertArrayEquals(expected, test.findDiagonalOrder(matrix));
43+
assertArrayEquals(expected, solutoin1.findDiagonalOrder(matrix));
4444
}
4545
}

0 commit comments

Comments
 (0)