Why?에서 시작해 How를 찾는 과정을 좋아합니다. 그 고민과 성장의 과정을 꾸준히 기록하고자 합니다.

[leetCode] 116. Populating Next Right Pointers in Each Node

🍰 Description You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. Initially, all next pointers are set to NULL. Example 1: Example 2: 🍰 Solution ![](https://images.velog.io/images/gygy/post/5e9b3a09-fc01-43f5-a48c-30112c83bb9c/

2021년 11월 11일
·
0개의 댓글
·

[leetCode] 617. Merge Two Binary Trees

🚀 Description You are given two binary trees root1 and root2. Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwise, the NOT null node will be used as the node of the new tree. Return the merged tree. Note: The merging process must start from the r

2021년 11월 11일
·
0개의 댓글
·

[leetCode] 695. Max Area of Island

Description You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. The area of an island is the number of cells with a value 1 in the island. Return the maximum area of an island in grid. If there is no island, return 0. Example 1:

2021년 11월 10일
·
0개의 댓글
·

[leetCode] 733. Flood Fill

👒 Description An image is represented by an m x n integer grid image where imagei represents the pixel value of the image. You are also given three integers sr, sc, and newColor. You should perform a flood fill on the image starting from the pixel imagesr. To perform a flood fill, consider the starting pixel, plus any pixels connected 4-directionally to the starting pixel of the same color as the starting pixel, plus any pixels connected 4-directionally to those pixels (also wi

2021년 11월 10일
·
0개의 댓글
·