关键是要排序,如AABBBBC,然后可比较,当相同时将当前位置向后移,而不增加统计数目,不同时增加统计数目,再退出第二循环,这样就可以统计了。 1
#include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 int n...
分类:
其他好文 时间:
2014-06-12 16:53:41
阅读次数:
182
function InsertSort($arr){ $num = count($arr);
for($i = 1; $i = 0; $j--){ if($arr[$j] > $key){ $arr[$j + 1...
分类:
Web程序 时间:
2014-06-12 16:51:05
阅读次数:
270
原题地址:https://oj.leetcode.com/problems/insert-interval/题意:Given
a set ofnon-overlappingintervals, insert a new interval into the intervals
(merge if ne...
分类:
编程语言 时间:
2014-06-12 16:13:09
阅读次数:
350
列表控件(CListCtrl)的顶部有一排按钮,用户可以通过选择不同的列来对记录进行排序。但是
CListCtrl并没有自动排序的功能,我们需要自己添加一个用于排序的回调函数来比较两个数据的大小,此外还需要响应排序按钮被点击的消息。下面讲述一下具体的做法。
CListCtrl提供了用于排序的函...
分类:
其他好文 时间:
2014-06-12 15:44:42
阅读次数:
163
原题地址:https://oj.leetcode.com/problems/text-justification/题意:Given
an array of words and a lengthL, format the text such that each line has
exactlyLcha...
分类:
编程语言 时间:
2014-06-12 15:12:05
阅读次数:
296
原题地址:https://oj.leetcode.com/problems/merge-intervals/题意:Given
a collection of intervals, merge all overlapping intervals.For
example,Given[1,3],[2,6]...
分类:
编程语言 时间:
2014-06-12 14:55:49
阅读次数:
235