본문 바로가기
728x90

LeetCode22

[LeetCode | Java | DFS 문제 풀이] 226. Invert Binary Tree - Solution with DFS 99클럽 | 비기너🌲 226. Invert Binary Tree🏷 Topic : Tree DFS; Depth-First Search BFS; Breadth-First Search Binary TreeEasyGiven the root of a binary tree, invert the tree, and return its root.Example 1:Input: root = [4,2,7,1,3,6,9]Output: [4,7,2,9,6,3,1]Example 2:Input: root = [2,1,3]Output: [2,3,1]Example 3:Input: root = []Output: []Constraints:The number of nodes in the tree is in the range [0, 100.. 2024. 6. 2.
[LeetCode | Java | Tree 문제 풀이] 2331. Evaluate Boolean Binary Tree - Solution with DFS 99클럽 | 비기너🌲 2331. Evaluate Boolean Binary Tree🏷 Topic : Tree Binary Tree DFS; Depth-First SearchEasyYou are given the root of a full binary tree with the following properties:Leaf nodes have either the value 0 or 1, where 0 represents False and 1 represents True.Non-leaf nodes have either the value 2 or 3, where 2 represents the boolean OR and 3 represents the boolean AND.The evaluation of a n.. 2024. 6. 1.
[LeetCode | Java | Tree 문제 풀이] 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree 99클럽 | Begginer🐾 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree🏷 Topic : Tree Binary Tree BFS DFSEasyGiven two binary trees original and cloned and given a reference to a node target in the original tree.The cloned tree is a copy of the original tree.Return a reference to the same node in the cloned tree.Note that you are not allowed to change any of the two trees or .. 2024. 5. 31.
[LeetCode | Java | Binary Search 문제 풀이] 2824. Count Pairs Whose Sum is Less than Target - Solution with 이중for문 99클럽 | Java | 비기너2824.Count Pairs Whose Sum is Less than Target🏷 Topic : Array Two Pointers Binary Search SortingEasyGiven a 0-indexed integer array nums of length n and an integer target, return the number of pairs (i, j) where 0 and nums[i] + nums[j] .Example 1: Input: nums = [-1,1,2,3,1], target = 2 Output: 3 Explanation: There are 3 pairs of indices that satisfy the conditions in th.. 2024. 5. 27.
728x90


Top