shreyansh

Trees Problems

  1. Amount of Time for Binary Tree to Be Infected

    You are given the root of a binary tree with unique values, and an integer start. At minute 0, an infection starts from

  2. Binary Tree

    Types of Binary Trees:

  3. Binary Tree Maximum Path Sum

    A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting

  4. Binary Tree Zigzag Level Order Traversal or Spiral Traversal

    Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right

  5. Bottom View

    Just remove the check from Top View's answer to ensure we consider the bottommost node at each horizontal level.

  6. Boundary Order Traversal

    You are given a binary tree having 'n' nodes.

  7. Diameter of a Binary Tree

    Given the root of a binary tree, return the length of the diameter of the tree.

  8. Flatten a binary tree

    Given the root of a binary tree, flatten the tree into a "linked list":

  9. Least Common Ancestor

    Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.

  10. Path Sum 2

    Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values

  11. Right View

    Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you c

  12. Same Tree

    Given the roots of two binary trees p and q, write a function to check if they are the same or not.

  13. Symmetric Trees

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

  14. Top View

    // Pair class to store node and its horizontal distance

  15. Two Sum IV Input in BST

    Given the root of a binary search tree and an integer k, return true if there exist two elements in the BST such that th

  16. Types of Binary Trees

    Types of Binary Trees:

  17. is Balanced Binary Tree

    Given a binary tree, determine if it is height-balanced.