Skip to content

Instantly share code, notes, and snippets.

@sausheong
Created May 3, 2022 03:22
Show Gist options
  • Save sausheong/0c96a03dfb49821a5a1570e2d3e33fde to your computer and use it in GitHub Desktop.
Save sausheong/0c96a03dfb49821a5a1570e2d3e33fde to your computer and use it in GitHub Desktop.
mst
type Stack struct {
nodes [][2]*Node
}
func (s *Stack) Push(n [2]*Node) {
s.nodes = append(s.nodes, n)
}
func (s *Stack) Pop() (n [2]*Node) {
n = s.nodes[len(s.nodes)-1]
s.nodes = s.nodes[:len(s.nodes)-1]
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment