리트코드 stack 4

[leetcode][Medium][Stack] 739. Daily Temperatures 풀이, 해설 (python)

https://leetcode.com/problems/daily-temperatures/ Daily Temperatures - LeetCode Can you solve this real interview question? Daily Temperatures - Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer leetcode.com 1차 풀이 class Solution(object): def dailyTemperatur..

[leetcode][Medium][Stack] 22. Generate Parentheses 힌트, 풀이, 해설 (python)

https://leetcode.com/problems/generate-parentheses/ Generate Parentheses - LeetCode Can you solve this real interview question? Generate Parentheses - Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Exa leetcode.com 힌트 https://www.youtube.com/watch?v=s9fokUqJ76A ..

[leetcode][Medium][Stack] 150. Evaluate Reverse Polish Notation 풀이, 해설 (python)

https://leetcode.com/problems/evaluate-reverse-polish-notation/ Evaluate Reverse Polish Notation - LeetCode Can you solve this real interview question? Evaluate Reverse Polish Notation - You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation [http://en.wikipedia.org/wiki/Reverse_Polish_notation]. Evaluate t leetcode.com 1차 풀이 class Solution..

[leetcode][Medium][Stack] 155. Min Stack 풀이, 해설 (python)

https://leetcode.com/problems/min-stack/ Min Stack - LeetCode Can you solve this real interview question? Min Stack - Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: * MinStack() initializes the stack object. * void push(int val) pushes t leetcode.com 1차 풀이 가벼운 스택 문제일거라 생각했는데, getMin 부분에서 어떻게 O(1)을 만들까 잠깐 고민했다. 그러다가 ..

반응형