Binary Tree Longest Consecutive Sequence
Given the reference to a binary tree, return the length of the longest path in the tree that contains consecutive values.
Given the reference to a binary tree, return the length of the longest path in the tree that contains consecutive values.
This question is asked by Apple. Given a list of positive numbers without duplicates and a target number, find all unique combinations of the numbers that sum to the target.
Given an array of numbers sorted in ascending order, return a height-balanced binary search tree using every number from the array.
Given a binary tree, return the bottom-left most value.
This question is asked by Facebook. Given an integer N, where N represents the number of pairs of parentheses (i.e. "(" and ")") you are given, return a list containing all possible well-formed parentheses you can create.
You're a thief trying to rob a binary tree. As a thief, you are trying to steal as much money as possible. The amount of money you steal is equivalent to the sum of all the node's values that you decide to rob. If two adjacent nodes are robbed, the authorities are automatically alerted. Return the maximum loot that you can steal without alerting the authorities.
Given a binary search tree, rearrange the tree such that it forms a linked list where all its values are in ascending order.
Given the reference to a binary search tree and a value to insert, return a reference to the root of the tree after the value has been inserted in a position that adheres to the invariants of a binary search tree.
Given the reference to a binary search tree, return the kth smallest value in the tree.
This question is asked by Amazon. Given a string s consisting of only letters and digits, where we are allowed to transform any letter to uppercase or lowercase, return a list containing all possible permutations of the string.
This question is asked by Google. Given a string of digits, return all possible text messages those digits could send.
Given the reference to a binary search tree, "level-up" the tree. Leveling-up the tree consists of modifying every node in the tree such that every node's value increases by the sum of all the node's values that are larger than it.
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
This question is asked by Google. Given an N-ary tree, return its maximum depth.
Given a binary search tree, return the minimum difference between any two nodes in the tree.
Given a binary search tree, return its mode (you may assume the answer is unique). If the tree is empty, return -1. Note: the mode is the most frequently occurring value in the tree.
Given a binary tree and a target, return whether or not there exists a root to leaf path such that all values along the path sum to the target.
Given an integer n, return whether or not it is a power of three.
This question is asked by Facebook. Given the root of a binary tree and two values low and high, return the sum of all values in the tree that are within low and high (inclusive).
Given a string s, remove the minimum number of parentheses to make s valid. Return all possible results.
Given two binary trees, return whether or not the two trees are identical. Note: identical meaning they exhibit the same structure and the same values at each node.
Given the reference to the root of a binary search tree and a search value, return the reference to the node that contains the value if it exists and null otherwise.
This question is asked by Amazon. Given two trees s and t, return whether or not t is a subtree of s.
Given a binary tree, return the sum of all left leaves of the tree.
Given a binary tree, return whether or not it forms a reflection across its center (i.e. a line drawn straight down starting from the root).
You are given the reference to the root of a binary tree and are asked to trim the tree of "dead" nodes. A dead node is a node whose value is listed in the provided dead array. Once the tree has been trimmed of all dead nodes, return a list containing references to the roots of all the remaining segments of the tree.
Given a binary tree, containing unique values, determine if it is a valid binary search tree.