package main // Stack ... type Stack []int // Top ... func (s Stack) Top() int { return s[len(s)-1] } // Empty ... func (s Stack) Empty() bool { return len(s) == 0 } // Push ... func (s *Stack) Push(val int) { *s = append(*s, val) } // Pop ... func (s *Stack) Pop() int { top := s.Top() *s = (*s)[:len(*s)-1] return top } // Stack64 ... type Stack64 []int64 // Top ... func (s Stack64) Top() int64 { return s[len(s)-1] } // Empty ... func (s Stack64) Empty() bool { return len(s) == 0 } // Push ... func (s *Stack64) Push(val int64) { *s = append(*s, val) } // Pop ... func (s *Stack64) Pop() int64 { top := s.Top() *s = (*s)[:len(*s)-1] return top }