Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3,
Return [1,3,3,1].Note:
Could you optimize your algorithm to use only O(k) extra space?分析:通过递归设置vector的值,变量i表示当前...
分类:
其他好文 时间:
2015-06-09 13:51:09
阅读次数:
96
L215: Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,
Gi...
分类:
其他好文 时间:
2015-06-07 09:40:21
阅读次数:
113
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1].
题目要求计算杨辉三角某一行的元素,这个也是二项式系数的计算问题。
class Solution {
public:
vector getRow(int row...
分类:
其他好文 时间:
2015-06-06 09:08:37
阅读次数:
114
Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For exampl...
分类:
其他好文 时间:
2015-06-05 22:23:05
阅读次数:
118
Well, this problem has a naive solution, which is to sort the array in descending order and return thek-1-th element. However, sorting algorithm gives...
分类:
其他好文 时间:
2015-06-03 00:38:52
阅读次数:
230
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1]....
分类:
其他好文 时间:
2015-06-02 23:30:17
阅读次数:
153
public class Solution { public int findKthLargest(int[] nums, int k) { return find(nums,nums.length-k,0,nums.length-1); } public int f...
分类:
其他好文 时间:
2015-05-31 18:09:20
阅读次数:
110
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For examp...
分类:
编程语言 时间:
2015-05-30 07:05:25
阅读次数:
251
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1].
Note:
Could you optimize your algorithm to use only O(k) extra space?
题意:和上一题差别在于只能用...
分类:
其他好文 时间:
2015-05-29 12:07:02
阅读次数:
124
leetcode 215: Kth Largest Element in an Array...
分类:
其他好文 时间:
2015-05-29 09:57:36
阅读次数:
103