Skip to content

Commit 2f2e3b5

Browse files
committed
Runtime: 0 ms (Top 100.00%) | Memory: 41.4 MB (Top 64.79%)
1 parent cf5a995 commit 2f2e3b5

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
// Runtime: 0 ms (Top 100.00%) | Memory: 41.4 MB (Top 64.79%)
12
/**
23
* Definition for singly-linked list.
34
* public class ListNode {
4-
* int val;
5-
* ListNode next;
6-
* ListNode() {}
7-
* ListNode(int val) { this.val = val; }
8-
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
5+
* int val;
6+
* ListNode next;
7+
* ListNode() {}
8+
* ListNode(int val) { this.val = val; }
9+
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
910
* }
1011
*/
1112
class Solution {
@@ -18,14 +19,14 @@ public int getDecimalValue(ListNode head) {
1819
ans = ans + temp.val * (int) Math.pow(2,pow++);
1920
temp = temp.next;
2021
}
21-
22+
2223
return ans;
2324
}
2425
public ListNode reverse(ListNode head){
2526
ListNode prev = null;
2627
ListNode pres = head;
2728
ListNode Next = pres.next;
28-
29+
2930
while(pres != null){
3031
pres.next = prev;
3132
prev = pres;
@@ -34,8 +35,8 @@ public ListNode reverse(ListNode head){
3435
Next = Next.next;
3536
}
3637
}
37-
38+
3839
head = prev;
3940
return head;
4041
}
41-
}
42+
}

0 commit comments

Comments
 (0)