Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5a2175e

Browse files
refactor 624
1 parent 7b10217 commit 5a2175e

File tree

1 file changed

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

1 file changed

+6
-6
lines changed

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
public class _624 {
88

99
public static class Solution1 {
10-
public int maxDistance(int[][] arrays) {
10+
public int maxDistance(List<List<Integer>> arrays) {
1111
List<Integer> max = new ArrayList<>();
12-
for (int[] array : arrays) {
13-
max.add(array[array.length - 1]);
12+
for (List<Integer> array : arrays) {
13+
max.add(array.get(array.size() - 1));
1414
}
1515
Collections.sort(max);
1616
int ans = Integer.MIN_VALUE;
17-
for (int[] array : arrays) {
18-
int big = array[array.length - 1] == max.get(max.size() - 1) ? max.get(max.size() - 2) : max.get(max.size() - 1);
19-
ans = Math.max(ans, big - array[0]);
17+
for (List<Integer> array : arrays) {
18+
int big = array.get(array.size() - 1) == max.get(max.size() - 1) ? max.get(max.size() - 2) : max.get(max.size() - 1);
19+
ans = Math.max(ans, big - array.get(0));
2020
}
2121
return ans;
2222
}

0 commit comments

Comments
 (0)