MCPcopy Create free account
hub / github.com/careercup/ctci / Push

Method Push

Go/Chapter 2/stack/stack.go:19–22  ·  view source on GitHub ↗

Push a new element onto the stack

(value int)

Source from the content-addressed store, hash-verified

17
18// Push a new element onto the stack
19func (s *Stack) Push(value int) {
20 s.top = &Element{value, s.top}
21 s.size++
22}
23
24// Remove the top element from the stack and return it's value
25// If the stack is empty, return nil

Callers 1

isPalindromeFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected