1. Introduction Given the root of a binary tree, flatten the tree into a “linked list”: The “linked list” should use the same TreeNode class […]
Leetcode 590. N-ary Tree Postorder Traversal using Recursion and Iteration.
1. Introduction Given the root of an n-ary tree, return the postorder traversal of its nodes’ values. This article is part of Binary Tree-Traversals. Read […]
Leetcode 589. N-ary Tree Preorder Traversal using Recursion and Iteration.
1. Introduction Given the root of an n-ary tree, return the preorder traversal of its nodes’ values. This article is part of Binary Tree-Traversals. Read […]
Leetcode 429. N-ary Tree Level Order Traversal.
1. Introduction Given an n-ary tree, return the level order traversal of its nodes’ values (i.e., from left to right, level by level). You can […]
Binary Tree Postorder Iterator.
Given the root of a Binary Tree, implement a Postorder Iterator with methods hasNext() and next(). 1. Introduction In this article, I will discuss how […]
Leetcode 144. Binary Tree Postorder Traversal.
Leetcode 144. Binary Tree Postorder Traversal: Given the root of a binary tree, return the Postorder traversal of its nodes’ values. This article is part […]
Leetcode 101. Symmetric Tree. Check whether tree is a mirror of itself.
1. Introduction Given the root of a binary tree, check whether it is a mirror of itself (symmetric around its center). 2. Content If the […]
Leetcode 100. Same Tree or Identical binary trees.
1. Introduction Given the roots of two binary trees p and q, write a function to check if they are the same or not. We […]
Leetcode 102. Binary Tree Level Order Traversal.
1. Introduction Given the root of a binary tree, return the binary tree level order traversal of its nodes’ values. (i.e., from left to right, […]
Leetcode 965. Univalued Binary Tree.
1. Introduction A binary tree is uni-valued if every node in the tree has the same value. Given the root of a binary tree, return […]
Binary Tree Preorder Iterator.
Given the root of a Binary Tree, implement a Preorder Iterator with methods hasNext() and next(). 1. Introduction In this article, I will discuss how […]
Leetcode 144. Binary Tree Preorder Traversal (Recursive and Iterative)
Given the root of a binary tree, return the Preorder traversal of its nodes’ values. 1. Introduction In this article, I will discuss how to […]
Leetcode 173. Binary Search Tree Iterator.
Given the root of a Binary Search Tree, implement an Inorder Iterator with methods hasNext() and next(). 1. Introduction In this article, I will discuss […]
Leetcode 94. Binary Tree Inorder Traversal (Recursive and Iterative)
Given the root of a binary tree, return the Inorder traversal of its nodes’ values. 1. Introduction In this article, I will discuss how to […]