Elephant Tree
Given a binary tree root, return the same tree except every node’s value is replaced by its original value plus all of the sums of its left and right subtrees.
Given a binary tree root, return the same tree except every node’s value is replaced by its original value plus all of the sums of its left and right subtrees.
Given integers n, faces, and total, return the number of ways it is possible to throw n dice with faces faces each to get total.
Given a binary tree root, return the sum of each of the diagonals in the tree starting from the top to bottom right.
Given a two dimensional list of integers votes, where each list has two elements [candidate_id, voter_id], report whether any voter has voted more than once.
You are given a list nums of length n + 1 picked from the range 1, 2, ..., n. By the pigeonhole principle, there must be a duplicate. Find and return it. The...
Given a binary tree root, repeatedly delete all leaves that have even values. That is, if after deletions, a node becomes a leaf with an even value, it too s...
Given a binary search tree root, an integer lo, and another an integer hi, remove all nodes that are not between [lo, hi] inclusive.
Given a binary tree root, count and return the number of nodes where its value is greater than or equal to the values of all of its descendants.
Given a list of integers nums, return the number of elements x there are such that x + 1 exists as well.
Given a binary search tree root, and integers lo and hi, return the count of all nodes in root whose values are between [lo, hi] (inclusive).
Given a binary tree root, remove all nodes with only one child.
You are given a two-dimensional list of integers intervals where each element is an inclusive interval [start, end]. Return whether there’s an interval which...