BFS4 [Leetcode/C#] 199. Binary Tree Right Side View 문제링크 https://leetcode.com/problems/binary-tree-right-side-view/?envType=study-plan-v2&envId=top-interview-150 199. Binary Tree Right Side View 637. Average of Levels in Binary Tree 랑 비슷한 개념이라 금방 풀 수 있었다. 637번 문제와 동일한 개념으로 풀면 되는데이 문제는 right side view 에서 봤을때 보이는 node 를 return 하면 되는 문제라서queue.Count 를 한 후 반복문 안에서 dequeue 해주고 마지막 요소일때 그 node 의 값을 result List 에 Add 해줬다. 기억하면 좋을 것 public class Solut.. 2024. 8. 17. [Leetcode/C#] 637. Average of Levels in Binary Tree 문제링크 https://leetcode.com/problems/average-of-levels-in-binary-tree/?envType=study-plan-v2&envId=top-interview-150 637. Average of Levels in Binary Tree 기억하면 좋을 것 public class Solution { Queue queue = new Queue(); List result = new List(); int sumInSameLevel = 0; int cntInSameLevel = 0; public IList AverageOfLevels(TreeNode root) { queue.Enqueue(root); traverse(.. 2024. 8. 17. [Leetcode/JS] 226. Invert Binary Tree 문제링크 226. Invert Binary Tree https://leetcode.com/problems/invert-binary-tree/description/ Invert Binary Tree - LeetCode Can you solve this real interview question? Invert Binary Tree - Given the root of a binary tree, invert the tree, and return its root. Example 1: [https://assets.leetcode.com/uploads/2021/03/14/invert1-tree.jpg] Input: root = [4,2,7,1,3,6,9] Output: [4 leetcode.com 문제 설명 Give.. 2023. 7. 18. [Leetcode/JS] 111. Minimum Depth of Binary Tree 문제링크 111. Minimum Depth of Binary Tree https://leetcode.com/problems/minimum-depth-of-binary-tree/description/ Minimum Depth of Binary Tree - LeetCode Can you solve this real interview question? Minimum Depth of Binary Tree - Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf.. 2023. 7. 13. 이전 1 다음