1 Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.Given nn and kk, return the kthk^{th} permutation sequence.
使用Next Permutation循环k次可以得到序列,但leetcode上提交会出现时间超过限制。下...
分类:
编程语言 时间:
2015-05-22 13:36:24
阅读次数:
129
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:
其他好文 时间:
2015-05-22 09:22:37
阅读次数:
110
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-05-22 09:22:05
阅读次数:
84
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].解题思...
分类:
其他好文 时间:
2015-05-22 09:20:44
阅读次数:
94
1 Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determ...
分类:
编程语言 时间:
2015-05-21 12:48:33
阅读次数:
144
Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al...
分类:
其他好文 时间:
2015-05-21 10:28:55
阅读次数:
159
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.解题思路:给出一个二叉树的中...
分类:
其他好文 时间:
2015-05-21 06:40:31
阅读次数:
121
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.解题思路:给出一个二叉树的先序...
分类:
其他好文 时间:
2015-05-21 06:37:42
阅读次数:
96
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.解题思路:用一个有序数组,创建一个平衡二叉查找树。为确保平衡,需要满足两子树的高度差不大于1,可以通过设置...
分类:
其他好文 时间:
2015-05-21 06:37:05
阅读次数:
123
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2015-05-21 06:36:41
阅读次数:
103