스택 3

[LeetCode] - 일일온도(파이썬)

풀이) 매일의 화씨 온도 리스트 T를 입력받아서, 더 따뜻한 날씨를 위해서 며칠을 더 기다려야 하는지 출력하라. 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] - 유효한 괄호

문제) 괄호로 된 입력값이 올바른지 판별하라 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 ▶ 입력 [](){} ▶ 출력 true 풀이)..

코딩테스트 공부 day3 [DFS/BFS]

본 자료는 '동빈나' 유튜브를 참고했습니다. https://www.youtube.com/watch?v=7C9RgOcvkvo 1.스택 자료구조 - 먼저 들어 온 데이터가 나중에 나가는 형식 (선입후출)의 자료 구조 - 입구와 출구가 동일한 형태 stack = [] # 삽입(5) - 삽입(2) - 삽입(3) - 삽입(7) - 삭제() - 삽입(1) - 삽입(4) - 삭제() stack.append(5) stack.append(2) stack.append(3) stack.append(7) stack.pop() stack.append(1) stack.append(4) stack.pop() print(stack[::-1]) #최상단 원소부터 출력 print(stack) #최하단 원소부터 출력 실행결과 [1,3,2..