Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion solution/0500-0599/0503.Next Greater Element II/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Solution {
let res = new Array(n).fill(-1);
for (let i = 0; i < 2 * n; i++) {
let cur = nums[i % n];
while(stack.length > 0 && nums[stack[stack.length - 1]] < cur) {
while (stack.length > 0 && nums[stack[stack.length - 1]] < cur) {
res[stack.pop()] = cur;
}
stack.push(i % n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Solution {
let res = new Array(n).fill(-1);
for (let i = 0; i < 2 * n; i++) {
let cur = nums[i % n];
while(stack.length > 0 && nums[stack[stack.length - 1]] < cur) {
while (stack.length > 0 && nums[stack[stack.length - 1]] < cur) {
res[stack.pop()] = cur;
}
stack.push(i % n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let res = new Array(n).fill(-1);
for (let i = 0; i < 2 * n; i++) {
let cur = nums[i % n];
while(stack.length > 0 && nums[stack[stack.length - 1]] < cur) {
while (stack.length > 0 && nums[stack[stack.length - 1]] < cur) {
res[stack.pop()] = cur;
}
stack.push(i % n);
Expand Down