原题地址先将数字转成字符串,然后排序,让能够组成更大数字的字符串放在前面,最后拼接成完整的字符串即可。有种很巧妙的方法判断两个字符串的大小关系,假设两个字符串是A,B,则比较AB和BA,若AB比BA大,说明A应该放在前面,即A &num) { 2 string res; 3 4 vecto...
分类:
其他好文 时间:
2015-01-26 19:00:19
阅读次数:
129
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 number is
9534330.
Note: The result may be very ...
分类:
其他好文 时间:
2015-01-24 14:29:39
阅读次数:
137
Largest Number2015.1.23 20:24Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, ...
分类:
其他好文 时间:
2015-01-23 21:26:27
阅读次数:
154
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,1,...
分类:
其他好文 时间:
2015-01-23 13:00:37
阅读次数:
101
想到的就是排序,把大的放在前面,注意下面的程序,如果数字本身是0,也会加到str中,如果用while(tmp),那么就加不到str中了,这里相当于一个do while,不过个人不喜欢用do while,所以这样写29 while(1)30 {31 ...
分类:
其他好文 时间:
2015-01-22 17:31:55
阅读次数:
157
题目: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-01-22 01:43:10
阅读次数:
198
题目链接:点击打开链接
题目信息:
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray ...
分类:
其他好文 时间:
2015-01-20 22:13:22
阅读次数:
210
Maximal RectangleGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.使用dpHeight[]数组来记...
分类:
其他好文 时间:
2015-01-20 21:45:37
阅读次数:
199
DescriptionYou are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse ca...
分类:
其他好文 时间:
2015-01-20 20:27:10
阅读次数:
191
Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the lar...
分类:
其他好文 时间:
2015-01-20 10:17:53
阅读次数:
331