Leetcode 0100. Same Tree

Posted on Mon 09 January 2023 in Leetcode • Tagged with binary-tree-traversal, recursion

Question Link : https://leetcode.com/problems/same-tree/

Difficulty: Easy

Premium: False

Question

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 …


Continue reading

Leetcode 0872. Leaf-Similar Trees

Posted on Wed 07 December 2022 in Leetcode • Tagged with binary-tree-traversal

Question Link : https://leetcode.com/problems/leaf-similar-trees/

Difficulty: Easy

Premium: False

Question

Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence.

For example, in the given tree above, the leaf value sequence is (6, 7, 4 …


Continue reading

Leetcode 0543. Diameter of Binary Tree

Posted on Fri 28 October 2022 in Leetcode • Tagged with binary-tree-traversal

Question Link : https://leetcode.com/problems/diameter-of-binary-tree/

Difficulty: Easy

Question

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 may or …


Continue reading

Leetcode 0104. Maximum Depth of Binary Tree

Posted on Sat 15 October 2022 in Leetcode • Tagged with binary-tree-traversal

Question Link : https://leetcode.com/problems/maximum-depth-of-binary-tree/

Difficulty: Easy

Question

Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.   Example 1:

Input: root = [3 …


Continue reading

Leetcode 0101. Symmetric Tree

Posted on Mon 10 October 2022 in Leetcode • Tagged with binary-tree-traversal

Question Link : https://leetcode.com/problems/symmetric-tree/

Difficulty: Easy

Question

Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).   Example 1:

Input: root = [1,2,2,3,4,4,3] Output: true

Example 2:

Input: root = [1,2 …


Continue reading