Awh ok. Sorry for the late reply. I think I understand what you're talking about. You want just the value correct not the object?. If that's what you want, you need two change two parts.
Stack Interface
interface Stack<T> { size: number top: StackNode<T> | null bottom: StackNode<T> | null push(val: T): number pop(): T | null }
Stack pop implementation
pop(): T | null { if (this.size > 0) { const nodeToBeRemove = this.top as StackNode<T> this.top = nodeToBeRemove.next this.size -= 1 nodeToBeRemove.next = null return nodeToBeRemove.value } return null }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Awh ok. Sorry for the late reply. I think I understand what you're talking about. You want just the value correct not the object?. If that's what you want, you need two change two parts.
Stack Interface
Stack pop implementation