存在数组A升序,B降序排列找到A,B两个数组中交集的第k个元素 思路:既然已经是AB都是排好序的了,那么让i从A的最后一个元素遍历,让j从B的第一个元素开始搜寻AB相等的元素。 1 #include "stdafx.h" 2 #include <iostream> 3 #include <vecto Read More
posted @ 2016-03-25 10:49 秋雨寒破春泥 Views(126) Comments(0) Diggs(0)
http://www.cnblogs.com/TenosDoIt/p/3681845.html 考虑几种情况 1,输入为: “000123”; 输出为: 123 2,输入为:空; 输出为: 0 3,输入为:“+123” 输出为: 123 4,输入为: “-123” 输出为: -123 5,输入为: Read More
posted @ 2016-03-25 10:02 秋雨寒破春泥 Views(132) Comments(0) Diggs(0)
2016-03-24 存在n个正整数,设计一个算法,按照一定的顺序将这n个数排列起来,使得连接起来的数最大,输出这个数。 例如,输入[5, 92. 8],,输出为9285; 注意: Read More
posted @ 2016-03-24 20:11 秋雨寒破春泥 Views(139) Comments(0) Diggs(0)
基本单链表的反转 Class Solution { public: if(head == NULL || head != NULL) return head; ListNode *p = head; ListNode *q = head -> next; while(q) { ListNode *t Read More
posted @ 2016-03-22 19:46 秋雨寒破春泥 Views(130) Comments(0) Diggs(0)