Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, fro…
标签:LeetCode题目解答汇总
LeetCode | Best Time to Buy and Sell Stock II(股票购买抛售问题II)
Say you have an array for which the ith element is the price of a given stock on day i. Design …
LeetCode | Distinct Subsequences(不同的子序列)
Given a string S and a string T, count the number of distinct subsequences of T in&nb…
LeetCode | Subsets(子集)
Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in n…
LeetCode | Flatten Binary Tree to Linked List(二叉树转化成链表)
Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flatte…
LeetCode | Search a 2D Matrix(二维矩阵中查找)
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has…
LeetCode | Convert Sorted List to Binary Search Tree(链表转换成二叉搜索树)
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. …
LeetCode | Permutations(全排列)
Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following p…
LeetCode | Remove Duplicates from Sorted Array II(删除重复的元素2)
Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice? For example,…
LeetCode | Divide Two Integers(两个数相除)
Divide two integers without using multiplication, division and mod operator. 题目解析: 求两个数相除,不能用乘除法。那么可以用加减法一点一点算…
LeetCode | Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicat…
LeetCode | Same Tree(相等的二叉树)
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered eq…