当集合或数组内的对象需要排序时,会利用Collections.sort或Arrays.sort来进行排序,通常会implement
Comparable,来实现自定义排序,透过回传值来表示排序的大小。
分类:
编程语言 时间:
2014-06-12 19:33:37
阅读次数:
239
原题地址:https://oj.leetcode.com/problems/jump-game/题意:Given
an array of non-negative integers, you are initially positioned at the first
index of the arr...
分类:
编程语言 时间:
2014-06-12 18:04:54
阅读次数:
540
原题地址:https://oj.leetcode.com/problems/jump-game-ii/题意:Given
an array of non-negative integers, you are initially positioned at the first
index of the ...
分类:
编程语言 时间:
2014-06-12 17:38:49
阅读次数:
323
首先IList泛型接口,是 ICollection泛型接口的子代,并且是所有泛型列表的基接口。
它仅仅是所有泛型类型的接口,并没有太多方法可以方便实用,如果仅仅用作数据集合的承载体,IList
可以实现。然而,经常我们需要对集合数据进行处理,如筛选或排序,这时就需要用List 。它们的主要区别在于....
分类:
Web程序 时间:
2014-06-12 17:17:08
阅读次数:
570
原题地址:https://oj.leetcode.com/problems/maximum-subarray/题意:Find
the contiguous subarray within an array (containing at least one number) which
has the ...
分类:
编程语言 时间:
2014-06-12 17:06:04
阅读次数:
339
关键是要排序,如AABBBBC,然后可比较,当相同时将当前位置向后移,而不增加统计数目,不同时增加统计数目,再退出第二循环,这样就可以统计了。 1
#include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 int n...
分类:
其他好文 时间:
2014-06-12 16:53:41
阅读次数:
182