본문 바로가기
반응형

Study/Algorithm38

[LeetCode] #232. Implement Queue using Stacks (python) 문제 https://leetcode.com/problems/implement-queue-using-stacks/ Implement Queue using Stacks - LeetCode 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 스택을 사용해서 큐를 구현하는 문제다. 예시 입출력 Input ["MyQueue", "push", "push", "peek", "pop", "empty"] [[], [1], [2], [], [], []] Output [null, null, null, .. 2022. 2. 24.
[LeetCode] #225. Implement Stack using Queues (python) 문제 https://leetcode.com/problems/implement-stack-using-queues/ Implement Stack using Queues - LeetCode 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 큐를 사용해서 스택을 구현해야 한다. push, top, pop, empty 기능을 구현하면 된다. 풀이 책 풀이 class MyStack: def __init__(self): self.q = collections.deque() def push(sel.. 2022. 2. 24.
[LeetCode] #739. Daily Temperatures (python) 문제 https://leetcode.com/problems/daily-temperatures/ Daily Temperatures - LeetCode 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 온도 리스트가 주어진다. 해당 온도보다 더 따뜻해질때까지 기다려야 하는 날짜를 리스트로 반환하고 따뜻해지지 않으면 0으로 반환한다. 예시 입출력 Input: temperatures = [73,74,75,71,69,72,76,73] Output: [1,1,4,2,1,1,0,0] 풀이 책 .. 2022. 2. 24.
[LeetCode] #316. Remove Duplicate Letters (python) 문제 https://leetcode.com/problems/remove-duplicate-letters/ Remove Duplicate Letters - LeetCode 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 중복된 문자를 제거하는데 출력 결과는 사전식 순서로 가장 작은 결과를 출력해야 한다. 대신 주어진 문자열에 있는 알파벳들은 한번씩 나와야 한다. 예시 입출력 Input: s = "bcabc" Output: "abc" 풀이 책 풀이 1. 재귀 class Solutio.. 2022. 2. 24.
반응형