We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7753977 commit c743abfCopy full SHA for c743abf
src/_DataStructures_/Stack/2-stacks-using1-array/index.js
@@ -40,6 +40,7 @@ class TwoStacks {
40
pop1() {
41
if (this.top1 >= 0) {
42
const item = this.data[this.top1];
43
+ delete this.data[this.top1];
44
this.top1 -= 1;
45
return item;
46
}
@@ -49,6 +50,7 @@ class TwoStacks {
49
50
pop2() {
51
if (this.top2 < this.capacity) {
52
const item = this.data[this.top2];
53
+ delete this.data[this.top2];
54
this.top2 += 1;
55
56
0 commit comments