Skip to content

Instantly share code, notes, and snippets.

@AahanSingh
Created July 11, 2021 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AahanSingh/74cbc518af51d342d6ac218f3c7c838c to your computer and use it in GitHub Desktop.
Save AahanSingh/74cbc518af51d342d6ac218f3c7c838c to your computer and use it in GitHub Desktop.
Stack Peek.go
func (s *Stack) peek() int {
if s.isEmpty() {
fmt.Print("Underflow.")
return -1
}
return (*s).data[(*s).top]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment