'while (k > 0) {' -> 'while (k > 0 && !stack.isEmpty()) {' (java.util.EmptyStackException)

pull/47/head
jaredliw 2021-10-02 21:28:11 +08:00
parent 465e997d84
commit 5472520ede
1 changed files with 1 additions and 1 deletions

View File

@ -75,7 +75,7 @@ class Solution {
}
stack.push(i);
}
while (k > 0) {
while (k > 0 && !stack.isEmpty()) {
stack.pop();
k--;
}