Skip to content

Commit 1116b99

Browse files
authored
Update Solution.java
1 parent 052e5ae commit 1116b99

File tree

1 file changed

+0
-7
lines changed
  • src/main/java/g1001_1100/s1019_next_greater_node_in_linked_list

1 file changed

+0
-7
lines changed

src/main/java/g1001_1100/s1019_next_greater_node_in_linked_list/Solution.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ public int[] nextLargerNodes(ListNode head) {
1111
int i = 0;
1212
int[] arr = new int[len];
1313
int[] idx = new int[len];
14-
1514
while (head != null) {
1615
arr[i] = head.val;
1716
head = head.next;
1817
i++;
1918
}
20-
2119
hlp(arr, idx, 0);
22-
2320
i = 0;
2421
while (i < idx.length) {
2522
int j = idx[i];
@@ -31,7 +28,6 @@ public int[] nextLargerNodes(ListNode head) {
3128
i++;
3229
}
3330
arr[i - 1] = 0;
34-
3531
return arr;
3632
}
3733

@@ -40,14 +36,11 @@ private void hlp(int[] arr, int[] idx, int i) {
4036
idx[i] = -1;
4137
return;
4238
}
43-
4439
hlp(arr, idx, i + 1);
4540
int j = i + 1;
46-
4741
while (j != -1 && arr[i] >= arr[j]) {
4842
j = idx[j];
4943
}
50-
5144
if ((j != -1) && arr[i] >= arr[j]) {
5245
idx[i] = -1;
5346
} else {

0 commit comments

Comments
 (0)