Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c743abf

Browse files
committed
update: delete the elements
1 parent 7753977 commit c743abf

File tree

1 file changed

+2
-0
lines changed
  • src/_DataStructures_/Stack/2-stacks-using1-array

1 file changed

+2
-0
lines changed

‎src/_DataStructures_/Stack/2-stacks-using1-array/index.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class TwoStacks {
4040
pop1() {
4141
if (this.top1 >= 0) {
4242
const item = this.data[this.top1];
43+
delete this.data[this.top1];
4344
this.top1 -= 1;
4445
return item;
4546
}
@@ -49,6 +50,7 @@ class TwoStacks {
4950
pop2() {
5051
if (this.top2 < this.capacity) {
5152
const item = this.data[this.top2];
53+
delete this.data[this.top2];
5254
this.top2 += 1;
5355
return item;
5456
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /