스택

    [LeetCode] 20. Valid Parentheses

    20. Valid Parentheses Easy Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket has a corresponding open bracket of the same type. Example 1: Input: s = "()" Output: true ..

    [LeetCode] 739. Daily Temperatures

    739. Daily Temperatures Medium 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 temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead. Example 1: Input: temperatures = [73,74,75,71,69,72,76,73] Output: [1,1,4,2,1,1,..

    [LeetCode] 84. Largest Rectangle in Histogram

    [LeetCode] 84. Largest Rectangle in Histogram

    84. Largest Rectangle in Histogram Hard Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. Example 1: Input: heights = [2,1,5,6,2,3] Output: 10 Explanation: The above is a histogram where width of each bar is 1. The largest rectangle is shown in the red area, which has an area = 1..

    10799 쇠막대기 백준 알고리즘 문제 스택

    Stack 괄호 문제를 풀고나서 다른 스택문제를 찾다가 괜찮은것 같은 문제를 발견했다. 바로 ! 10799 쇠막대기 https://www.acmicpc.net/problem/10799괄호를 스택에 넣으면서 열고 닫히는 괄호를 확인하여 쪼개지는 쇠막대기의 갯수를 세어 출력한다.쇠막대기 성공문제집 시간 제한메모리 제한제출정답맞은 사람정답 비율1 초256 MB31871735134254.398%문제여러 개의 쇠막대기를 레이저로 절단하려고 한다. 효율적인 작업을 위해서 쇠막대기를 아래에서 위로 겹쳐 놓고, 레이저를 위에서 수직으로 발사하여 쇠막대기들을 자른다. 쇠막대기와 레이저의 배치는 다음 조건을 만족한다.쇠막대기는 자신보다 긴 쇠막대기 위에만 놓일 수 있다. - 쇠막대기를 다른 쇠막대기 위에 놓는 경우 완전히..