Leetcode Solution
Data Structure
Merge Two Binary Trees
Programmer - 0
In this article, we learn how to Merge Two Binary Trees with example and two different approaches. First approach is In Java using recursion (By creating...
Data Structure
Check Same Binary Tree
Programmer - 0
Check Same Binary Tree
Question: Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if...
Data Structure
Convert BST to Greater Tree
Programmer - 0
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the...
Data Structure
Binary Tree Path Sum III
Programmer - 0
You are given a binary tree in which each node contains an integer value.
Find the number of paths that sum to a given value.
The...
Data Structure
Binary Tree Path Sum II
Programmer - 0
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree...
Data Structure
Binary Tree Path Sum
Programmer - 0
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the...
Data Structure
Minimum Depth of Binary Tree
Programmer - 0
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...
Data Structure
Maximum Depth of Binary Tree
Programmer - 0
Question :
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node...
Data Structure
Binary Tree Level Order Traversal
Programmer - 0
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree ,
...