Skip to content

Commit d4bc43a

Browse files
committed
Runtime: 1392 ms (Top 16.70%) | Memory: 41.2 MB (Top 71.62%)
1 parent efe5ed3 commit d4bc43a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 1392 ms (Top 16.70%) | Memory: 41.2 MB (Top 71.62%)
12
class Solution {
23
public:
34
vector<int> nextLargerNodes(ListNode* head) {
@@ -7,15 +8,15 @@ class Solution {
78
ans.push_back(0);
89
return ans;
910
}
10-
11+
1112
while(curr != NULL){
1213
ListNode* next = curr->next;
1314
while(next != NULL){
1415
if(next->val > curr->val){
1516
ans.push_back(next->val);
1617
break;
17-
}
18-
next = next->next;
18+
}
19+
next = next->next;
1920
}
2021
if(next == NULL){
2122
ans.push_back(0);
@@ -24,4 +25,4 @@ class Solution {
2425
}
2526
return ans;
2627
}
27-
};
28+
};

0 commit comments

Comments
 (0)