'while (k > 0) {' -> 'while (k > 0 && !stack.isEmpty()) {' (java.util.EmptyStackException)
parent
465e997d84
commit
5472520ede
|
@ -75,7 +75,7 @@ class Solution {
|
||||||
}
|
}
|
||||||
stack.push(i);
|
stack.push(i);
|
||||||
}
|
}
|
||||||
while (k > 0) {
|
while (k > 0 && !stack.isEmpty()) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
k--;
|
k--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue