목록DFS (80)
넘치게 채우기
https://leetcode.com/problems/find-all-groups-of-farmland/description/ Leetcode - Find All Groups of Farmland 문제 유형 : dfs/bfs, 행렬 문제 난이도 : Medium 문제 You are given a 0-indexed m x n binary matrix land where a 0 represents a hectare of forested land and a 1 represents a hectare of farmland. To keep the land organized, there are designated rectangular areas of hectares that consist entirely of farm..
https://leetcode.com/problems/smallest-string-starting-from-leaf/description/ Leetcode - Smallest String Starting From Leaf 문제 유형 : 이진트리, 재귀, dfs 문제 난이도 : Medium 문제 You are given the root of a binary tree where each node has a value in the range [0, 25] representing the letters 'a' to 'z'. Return the lexicographically smallest string that starts at a leaf of this tree and ends at the root. As a ..
https://leetcode.com/problems/add-one-row-to-tree/description/ LeetCode - Add One Row to Tree 문제 유형 : 이진트리, dfs, 재귀 문제 난이도 : Medium 문제 Given the root of a binary tree and two integers val and depth, add a row of nodes with value val at the given depth depth. Note that the root node is at depth 1. The adding rule is: Given the integer depth, for each not null tree node cur at the depth depth - 1,..
https://leetcode.com/problems/sum-root-to-leaf-numbers/description/ Leetcode - Sum Root to Leaf Numbers 문제 유형 : dfs, 이진트리 문제 난이도 : Medium 문제 You are given the root of a binary tree containing digits from 0 to 9 only. Each root-to-leaf path in the tree represents a number. For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123. Return the total sum of all root-to-leaf numbers. T..
https://leetcode.com/problems/sum-of-left-leaves/description/ Leetcode - Sum of Left Leaves 문제 유형 : 이진 트리, dfs, 재귀 문제 난이도 : Easy 문제 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. 이진 트리의 루트가 주어진다. 모든 왼쪽 잎 노드의 값의 합을 구하시오. 잎 노드란 자식 노드가 없는 노드를 말합니다. 풀이 말 그대로 이진트리를 순회하면서 왼쪽 리프노드의 합을 반..
https://leetcode.com/problems/word-search/description/ Leetcode - Word Search 문제 유형 : 문자열 처리, dfs, 백트래킹 문제 난이도 : Medium 문제 Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used m..
https://school.programmers.co.kr/learn/courses/30/lessons/43163 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 프로그래머스 - 단어 변환 문제 유형 : DFS/BFS 문제 난이도 : Level 3 문제 두 개의 단어 begin, target과 단어의 집합 words가 있습니다. 아래와 같은 규칙을 이용하여 begin에서 target으로 변환하는 가장 짧은 변환 과정을 찾으려고 합니다. 1. 한 번에 한 개의 알파벳만 바꿀 수 있습니다. 2. words에 있는 단어로만 변환할 수 있습니다. 예를 들어 beg..
https://leetcode.com/problems/find-bottom-left-tree-value/description/ Leetcode - Find Bottom Left Tree Value 문제 유형 : 트리, dfs, 재귀 문제 난이도 : Medium 문제 Given the root of a binary tree, return the leftmost value in the last row of the tree. 이진 트리의 루트가 주어진다. 트리의 마지막 행의 가장 왼쪽 값을 반환하시오. 풀이 dfs를 하면서, 각 노드의 왼쪽, 오른쪽별로 더 깊이 있는 노드를 재귀적으로 반환하면 된다. 의 형태로 값을 반환시킨다. 같은 깊이라면, 더 왼쪽의 노드를 상위 노드에 반환한다. 코드 C++ /** * ..
https://leetcode.com/problems/diameter-of-binary-tree/description/ Diameter of Binary Tree - LeetCode Can you solve this real interview question? Diameter of Binary Tree - Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path leetcode.com Leetcode - Diameter of Bin..
https://leetcode.com/problems/pseudo-palindromic-paths-in-a-binary-tree/description/?envType=daily-question&envId=2024-01-24 LeetCode - The World's Leading Online Programming Learning Platform 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 LeetCode - Pseudo-Palindromic Paths in a Binary Tr..