Find thekth largest element in an unsorted array.For example,Given[3,2,1,5,6,4]and k = 2, return 5.Note:You may assume k is always valid, 1 ≤ k ≤ arra...
分类:
其他好文 时间:
2015-05-23 12:50:52
阅读次数:
134
用递归的方法找到从1到最大的N位整数。
样例
给出 N = 1,
返回[1,2,3,4,5,6,7,8,9].
给出 N = 2,
返回[1,2,3,4,5,6,7,8,9,10,11,...,99].
注意
用下面这种方式去递归其实很容易:
recursion(i) {
if i > largest number:
return...
分类:
其他好文 时间:
2015-05-21 22:43:48
阅读次数:
441
1.Given an array of integers, find a contiguous subarray which has the largest sum.hint: Go through the array with 2 variable -- cur and count. cur i....
分类:
其他好文 时间:
2015-05-21 16:52:25
阅读次数:
107
For example,Given height = [2,1,5,6,2,3],return 10.解题思路:参考Problem H: Largest Rectangle in a Histogram 第四种思路,或者翻译版Largest Rectangle in Histogram@LeetCo...
分类:
编程语言 时间:
2015-05-19 20:43:54
阅读次数:
174
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.解题思路:求01矩阵中,全是1的子矩阵的最大面积。把矩阵按照每一行...
分类:
编程语言 时间:
2015-05-19 20:39:59
阅读次数:
280
链接 :
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=30726
题意 : 有向图G,求一个最大的点集,使得点集中任意两个节点u和v,满足 要么u可以到达v,要么v可以到达u,或者u和v可以相互到达。
可以强连通缩点成一张DAG,以为每个强连通分量要么选要么不选。求DAG上的最长路 二次建图 用了2种不同的...
分类:
其他好文 时间:
2015-05-19 16:32:12
阅读次数:
112
1.将数字转换为字符串
2.对字符串数组进行升序排序
3.具体的排序规则为将两个字符串以str1+str2和str2+str1的方式拼接起来,然后比较两个拼接后的字符串即可
4.将排好序的字符串数组拼接起来即为要求的最大整数字符串
ps:刚开始走了好多弯路以比较短的字符串为基准和比较长的字符串循环比较,直至有不同大小的段为止,吃力不讨好,最后也没有算对^-^!...
分类:
其他好文 时间:
2015-05-19 10:37:34
阅读次数:
91
【题目】Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], the largest formed...
分类:
其他好文 时间:
2015-05-18 20:38:52
阅读次数:
105
地址:https://oj.leetcode.com/problems/maximal-rectangle/Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones...
分类:
其他好文 时间:
2015-05-16 11:54:21
阅读次数:
176
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [?2,1,?3,4,?1,2,...
分类:
编程语言 时间:
2015-05-15 10:35:46
阅读次数:
160