add: 最小栈

This commit is contained in:
2020-05-12 22:30:19 +08:00
parent 36b0434402
commit 7055121867
3 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import { MinStack } from '../../src/stack/min-stack'
test('最小栈', () => {
var obj = new MinStack()
obj.push(1)
obj.push(3)
obj.push(2)
obj.pop()
var top = obj.top()
var min = obj.getMin()
expect(top).toBe(3)
expect(min).toBe(1)
})