solution

package
v0.0.0-...-291ea56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MinStack

type MinStack struct {
	// contains filtered or unexported fields
}

MinStack is a simple stack implementation for LeetCode

func Constructor

func Constructor() MinStack

Constructor represents as MinStack's constructor

func (*MinStack) GetMin

func (ms *MinStack) GetMin() int

GetMin returns the min value of the stack. Operation cost is O(1) because it just returns the pre-calcurated value.

func (*MinStack) Pop

func (ms *MinStack) Pop()

Pop removes the top of the element of the stack

func (*MinStack) Push

func (ms *MinStack) Push(x int)

Push just pushes an element on top of the stack

func (*MinStack) Top

func (ms *MinStack) Top() int

Top returns the latest value of the stack

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL