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

Method Pop

Go/Chapter 2/stack/stack.go:26–33  ·  view source on GitHub ↗

Remove the top element from the stack and return it's value If the stack is empty, return nil

()

Source from the content-addressed store, hash-verified

24// Remove the top element from the stack and return it's value
25// If the stack is empty, return nil
26func (s *Stack) Pop() (value int) {
27 if s.size > 0 {
28 value, s.top = s.top.value, s.top.next
29 s.size--
30 return value
31 }
32 return -1
33}

Callers 1

isPalindromeFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected