File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -8,18 +8,31 @@ export class Stack {
8
8
}
9
9
10
10
push ( value : number ) : void {
11
- throw new Error ( 'Not implemented' ) ;
11
+ // ListNode newNode = new ListNode(value);
12
+ // newNode.next = top;
13
+ // top = newNode;
12
14
}
13
15
14
16
pop ( ) : number | undefined {
15
- throw new Error ( 'Not implemented' ) ;
17
+ return 0 ;
18
+ // if (this.isEmpty()) {
19
+ // throw new EmptyStackException();
20
+ // } else {
21
+ // int value = top.val;
22
+ // top = top.next;
23
+ // return value;
24
+ // }
16
25
}
17
26
18
27
peek ( ) : number | null {
19
- throw new Error ( 'Not implemented' ) ;
28
+ return 0 ;
29
+ // if (this.isEmpty()) {
30
+ // throw new EmptyStackException();
31
+ // }
32
+ // return top.val;
20
33
}
21
34
22
35
isEmpty ( ) : boolean {
23
- throw new Error ( 'Not implemented' ) ;
36
+ return top == null ;
24
37
}
25
38
}
You can’t perform that action at this time.
0 commit comments