[Typescript] 단일 연결 리스트 Stack 구조 만들기
·
Programming/Typescript
[ String 타입만 받는 Stack ] interface Stack { readonly size: number; push(value: string): void; pop(): string; } type StackNode = { readonly value: string; readonly next?: StackNode; } class Stack_Impl implements Stack { private _size: number = 0; private head?: StackNode; constructor(private capacity: number) {} get size() { return this._size; } push(value: string) { if (this.capacity === this.size..