본문 바로가기

leet code41

[LEET CODE] 739. Daily Temperatures # Problem Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead. For example, given the list of temperatures T = [73, 74, 75, 71, 69, 72, 76, 73], your output should be [1, 1, 4, 2, 1, 1, 0, 0]. Note: The length of temp.. 2021. 3. 29.
[LEET CODE] 232. Implement Queue using Stacks # Problem Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Implement the MyQueue class: void push(int x) Pushes element x to the back of the queue. int pop() Removes the element from the front of the queue and returns it. int peek() Returns the element at the front of the queu.. 2021. 3. 26.
[LEET CODE] 225. Implement Stack using Queues # Problem Implement a last in first out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal queue (push, top, pop, and empty). Implement the MyStack class: void push(int x) Pushes element x to the top of the stack. int pop() Removes the element on the top of the stack and returns it. int top() Returns the element on the top of the stack. boolean.. 2021. 3. 26.
❗️[LEET CODE] 316. Remove Duplicate Letters # Problem Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results. Note: This question is the same as 1081: https://leetcode.com/problems/smallest-subsequence-of-distinct-characters/ Constraints: 1 str: counter, seen, stack = collections.Counter(s), set(), [] for.. 2021. 3. 23.
[LEET CODE] 92. Reverse Linked List II # Problem Given the head of a singly linked list and two integers left and right where left 2021. 3. 23.
[LEET CODE] 328. Odd Even Linked List # Problem Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list. The first node is considered odd, and the second node is even, and so on. Note that the relative order inside both the even and odd groups should remain as it was in the input. Constraints: The number of nodes in the linked list i.. 2021. 3. 23.
반응형