일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- list
- Array
- 중간
- 미디움
- binary search
- 쉬움
- 이진트리
- string
- linked list
- binary tree
- backtracking
- matrix
- Binary
- 문자열
- hash table
- tree
- two pointers
- Depth-first Search
- Medium
- dfs
- DP
- sorting
- 리트코드
- recursive
- 재귀
- Python
- HashTable
- leetcode
- math
- easy
- Today
- Total
목록dfs (12)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/path-sum/ Path Sum - LeetCode Can you solve this real interview question? Path Sum - Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum. A leaf is a node with no ch leetcode.com 2. 문제 설명 이진 트리 root와, 정수 targetSum가 주어졌을 때, root에서 leaf로 이어..
1. 문제 링크 https://leetcode.com/problems/balanced-binary-tree/ 2. 문제 설명 이진트리가 주어질 때, 이 트리가 height-balanced 되있는지에 따른 boolean을 반환 height-balanced의 정의 모든 노드의 두개의 subtree의 depth가 1개보다 더 차이나지 않는 이진트리 예시1) 아래 트리의 경우 루트 노드 3에 대해 subtree의 depth가 왼쪽 오른쪽 각각 1, 2이고 노드 9는 0,0, 노드 20은 각각 1,1로 depth가 1보다 더 차이나는 게 없으므로 True를 반환 3 / \ 9 20 / \ 15 7 예시2) 아래 트리의 경우 루트노드 1에 대해 subtree의 depth가 왼쪽 3, 오른쪽 1이기 때문에 1보다 더..
1. 문제 링크 https://leetcode.com/problems/maximum-depth-of-binary-tree/ Number of 1 Bits - LeetCode Can you solve this real interview question? Number of 1 Bits - Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight [http://en.wikipedia.org/wiki/Hamming_w leetcode.com 2. 문제 설명 이진 트리 root가 주어졌을 때, 최대 ..
1. 문제 링크 https://leetcode.com/problems/same-tree/ Same Tree - LeetCode Can you solve this real interview question? Same Tree - Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the leetcode.com 2. 문제 설명 이진 트리 p, q가 주어졌을 때, 두 트리가 같은 tree인지 판단 같다의 정의: 구조..