Skip to content

Commit 992be27

Browse files
author
AmiyahJo
committed
feat: adds java implementation for reference
1 parent d598b70 commit 992be27

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

lesson_12/structs_ts/src/stack.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,31 @@ export class Stack {
88
}
99

1010
push(value: number): void {
11-
throw new Error('Not implemented');
11+
// ListNode newNode = new ListNode(value);
12+
// newNode.next = top;
13+
// top = newNode;
1214
}
1315

1416
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+
// }
1625
}
1726

1827
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;
2033
}
2134

2235
isEmpty(): boolean {
23-
throw new Error('Not implemented');
36+
return top == null;
2437
}
2538
}

0 commit comments

Comments
 (0)