[LeetCode] 155. Min Stack (JavaScript)


[LeetCode] 155. Min Stack (JavaScript)

https://leetcode.com/problems/min-stack Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com minStack이란걸 구현하는 문제였다. min값을 추출하는 기능이 있는 스택이란다. stack이 min값또한 가질 수 있게 하여 풀 수 있었다. var MinStack = function () { this.stack = []; }; /** * @param {number} val * @return {void} */ MinStack.prototype.push = function (val) { let min = this.stack.length === 0 ? val : this.stack[this.stack.length - 1][1]; this....


#leetcodeMinStack #leetcodeMinStackjavascript #leetcodeMinStack자바스크립트

원문링크 : [LeetCode] 155. Min Stack (JavaScript)