摘要:
题目:Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending o... 阅读全文
摘要:
题目:Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must n... 阅读全文
摘要:
题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the tele... 阅读全文
摘要:
题目: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 and ... 阅读全文
摘要:
题目: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 path equals the given su... 阅读全文
摘要:
题目:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the d... 阅读全文
摘要:
题目:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题解:先复习下什么是二叉搜索树(引自Wikipedia):二叉查找树(Binary Search ... 阅读全文
摘要:
题目: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 to the neares... 阅读全文
摘要:
题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthes... 阅读全文
摘要:
题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 /... 阅读全文