All Nodes Distance K in Binary Tree
Given the root of a binary tree, the value of a target node target, and an integer k, return an array of the values of all nodes that have a distance k from the target node.
Given the root of a binary tree, the value of a target node target, and an integer k, return an array of the values of all nodes that have a distance k from the target node.
Given a binary tree, determine if it is height-balanced.
A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once.
Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
Return a deep copy (clone) of the graph.
Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.
Given the root of a binary tree, return the length of the diameter of the tree.
An image is represented by an m x n integer grid image where image[i][j] represents the pixel value of the image.
Given the root of a binary tree, invert the tree, and return its root.
Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree.
Given an m x n integers matrix, return the length of the longest increasing path in matrix.
Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
You are given an integer array nums with no duplicates. A maximum binary tree can be built recursively from nums using the following algorithm...
Given the root of a binary tree, return its maximum depth.
Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree.
There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges.
Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.
Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum.
Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum.
Given the roots of two binary trees p and q, write a function to check if they are the same or not.
Design an algorithm to serialize and deserialize a binary tree.
Sort Items by Groups Respecting Dependencies...
Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise.
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).
Given the root of a binary tree, determine if it is a valid binary search tree (BST).
Given an m x n grid of characters board and a string word, return true if word exists in the grid.
Given an m x n board of characters and a list of strings words, return all words on the board.