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 e3b3076 commit 399d2e4Copy full SHA for 399d2e4
implement-queue-using-stacks-lcci/index.ts
@@ -11,11 +11,11 @@ class MyQueue<T = any> {
11
if (!this.#inStack.length) {
12
return -1;
13
}
14
- this.in2out();
+ this.#in2out();
15
16
return this.#outStack.pop() as T;
17
18
- in2out() {
+ #in2out() {
19
while (this.#inStack.length) {
20
this.#outStack.push(this.#inStack.pop() as T);
21
@@ -25,7 +25,7 @@ class MyQueue<T = any> {
25
26
27
28
29
30
return this.#outStack[this.#outStack.length - 1] as T;
31
0 commit comments