리트코드 two pointers 3

[leetcode][Easy][Stack] 20. Valid Parentheses 풀이, 해설 (python)

https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Can you solve this real interview question? Valid Parentheses - Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the sam leetcode.com 1차 풀이 단순한 스택 문제라 간단히 풀었지만, 조건이 추가가 되면서 좀 복잡한 풀이가 되..

[leetcode][Hard][Two Pointers] 42. Trapping Rain Water 풀이, 해설 (python) : 해설 참고해서 푼 풀이

https://leetcode.com/problems/trapping-rain-water/ Trapping Rain Water - LeetCode Can you solve this real interview question? Trapping Rain Water - Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Example 1: [https://assets.leetcode.com/upl leetcode.com 한시간 정도 풀릴까 말까 하다가, 풀리지 않아서 ... 결국 해설을 본 풀이이다. 일단,..

[leetcode][Medium][Two Pointers] 11. Container With Most Water 풀이, 해설 (python)

https://leetcode.com/problems/container-with-most-water/ Container With Most Water - LeetCode Can you solve this real interview question? Container With Most Water - You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that toget leetcode.com 1차 풀이 일단 단순하게, O(n^2)로 접근했다. 그랬더니 ..

반응형