목록2024/07 (32)
넘치게 채우기
https://leetcode.com/problems/build-a-matrix-with-conditions/description/leetcode - Build a Matrix With Conditions문제 유형 : 행렬, 위상 정렬문제 난이도 : Hard 문제You are given a positive integer k. You are also given:a 2D integer array rowConditions of size n where rowConditions[i] = [abovei, belowi], anda 2D integer array colConditions of size m where colConditions[i] = [lefti, righti].The two arrays contain ..
https://leetcode.com/problems/find-valid-matrix-given-row-and-column-sums/description/leetcode - Find Valid Matrix Given Row and Column Sums문제 유형 : 그리디, 행렬문제 난이도 : Medium 문제You are given two arrays rowSum and colSum of non-negative integers where rowSum[i] is the sum of the elements in the ith row and colSum[j] is the sum of the elements of the jth column of a 2D matrix. In other words, you do n..
https://leetcode.com/problems/lucky-numbers-in-a-matrix/description/leetcode - Lucky Numbers in a Matrix문제 유형 : 행렬문제 난이도 : Easy 문제Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order.A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in its column. m x n의 행렬이 주어진다.럭키넘버들을 찾아서 반환하시오. 순서는 상관없습니다. 럭키넘버는 한 행에..
https://leetcode.com/problems/number-of-good-leaf-nodes-pairs/description/leetcode - Number of Good Leaf Nodes Paris문제 유형 : 이진트리, 재귀문제 난이도 : Medium 문제You are given the root of a binary tree and an integer distance. A pair of two different leaf nodes of a binary tree is said to be good if the length of the shortest path between them is less than or equal to distance.Return the number of good leaf..
https://leetcode.com/problems/delete-nodes-and-return-forest/description/leetcode - Delete Nodes And Return Forest문제 유형 : 이진트리, 재귀문제 난이도 : Medium 문제Given the root of a binary tree, each node in the tree has a distinct value.After deleting all nodes with a value in to_delete, we are left with a forest (a disjoint union of trees).Return the roots of the trees in the remaining forest. You may retur..
https://leetcode.com/problems/step-by-step-directions-from-a-binary-tree-node-to-another/description/leetcode - Step-By-Step Directions From a Binary Tree Node to Another문제 유형 : 이진트리, 재귀, 백트래킹문제 난이도 : Medium 문제You are given the root of a binary tree with n nodes. Each node is uniquely assigned a value from 1 to n. You are also given an integer startValue representing the value of the start node ..
https://leetcode.com/problems/create-binary-tree-from-descriptions/description/leetcode - Create Binary Tree From Descriptions문제 유형 : 이진트리문제 난이도 : Medium 문제You are given a 2D integer array descriptions where descriptions[i] = [parenti, childi, isLefti] indicates that parenti is the parent of childi in a binary tree of unique values. Furthermore,If isLefti == 1, then childi is the left child of ..
https://leetcode.com/problems/number-of-atoms/description/leetcode - Number of Atoms문제 유형 : 스택, 재귀, 문자열 처리문제 난이도 : Hard 문제Given a string formula representing a chemical formula, return the count of each atom.The atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name.One or more digits representing that element's count may follow if th..
https://leetcode.com/problems/robot-collisions/description/leetcode - Robot Collisions문제 유형 : 스택문제 난이도 : Hard 문제There are n 1-indexed robots, each having a position on a line, health, and movement direction.You are given 0-indexed integer arrays positions, healths, and a string directions (directions[i] is either 'L' for left or 'R' for right). All integers in positions are unique.All robots sta..
https://leetcode.com/problems/maximum-score-from-removing-substrings/leetcode - Maximum Score From Removing Substrings문제 유형 : 그리디, 스택, 슬라이딩 윈도우 문제 난이도 : Medium 문제You are given a string s and two integers x and y. You can perform two types of operations any number of times. Remove substring "ab" and gain x points. For example, when removing "ab" from "cabxbae" it becomes "cxbae". Remove substring..