Algorithm

    [LeetCode] 404. Sum of Left Leaves (Daily Question)

    [LeetCode] 404. Sum of Left Leaves (Daily Question)

    문제 Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children.A left leaf is a leaf that is the left child of another node. 이진트리가 주어졌을 때, 왼쪽 leaf node의 값의 합을 구하는 문제이다. Example 1: Input: root = [3,9,20,null,null,15,7] Output: 24 Explanation: There are two left leaves in the binary tree, with values 9 and 15 respectively. Example 2: Input: root = [1] Outp..

    [LeetCode] 85. Maximal Rectangle (Daily Question)

    [LeetCode] 85. Maximal Rectangle (Daily Question)

    문제 Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. 0과 1로 이루어진 테이블이 주어졌을 때, 1로 만들 수 있는 가장 큰 사각형의 넓이를 구하는 문제이다. Example 1: Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]] Output: 6 Explanation: The maximal rectangle is shown in the above picture. Example 2: Input..

    [LeetCode] 42. Trapping Rain Water (Daily Question)

    [LeetCode] 42. Trapping Rain Water (Daily Question)

    문제 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: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: The above elevation map (black section) is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain w..

    [LeetCode] 402. Remove K Digits (Daily Question)

    문제 Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num. 숫자 문자열 num에서 k개의 digit(0-9)을 없애서 가장 작은 수를 만드는 문제이다. Example 1: Input: num = "1432219", k = 3 Output: "1219" Explanation: Remove the three digits 4, 3, and 2 to form the new number 1219 which is the smallest. Example 2: Input: num = "10200", k = 1 O..

    [LeetCode] 950. Reveal Cards In Increasing Order (Daily Question)

    문제 You are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the ith card is deck[i]. You can order the deck in any order you want. Initially, all the cards start face down (unrevealed) in one deck. You will do the following steps repeatedly until all cards are revealed: - Take the top card of the deck, reveal it, and take it out of the d..

    [LeetCode] 2073. Time Needed to Buy Tickets (Daily Question)

    문제 There are n people in a line queuing to buy tickets, where the 0th person is at the front of the line and the (n - 1)th person is at the back of the line. You are given a 0-indexed integer array tickets of length n where the number of tickets that the ith person would like to buy is tickets[i]. Each person takes exactly 1 second to buy a ticket. A person can only buy 1 ticket at a time and ha..