08 2016 档案

摘要:1.旋转数组中找最小值 顺序查找时间复杂度为O(n),二分查找时间复杂度为O(logn) 1 // rotateArrMin.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 using namespa 阅读全文
posted @ 2016-08-30 22:40 lp3318 阅读(142) 评论(0) 推荐(0)
摘要:/******************************** 开始时间:2016-08-28 结束时间: *********************************/ 1.斐波那契数列:0,1,1,2,3,5,8 ······ 题目:获得斐波那契第n项,输出前n项; // Fibona 阅读全文
posted @ 2016-08-29 22:37 lp3318 阅读(116) 评论(0) 推荐(0)
摘要:时间复杂度为O(n*n),空间复杂度为O(n)的解法 1 // ShortJobFirst.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <vector> 7 8 using na 阅读全文
posted @ 2016-08-28 22:54 lp3318 阅读(289) 评论(0) 推荐(0)
摘要:1.归并排序: 1 // mergeSort.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 using namespace std; 7 8 void m_sort(int arr[],int te 阅读全文
posted @ 2016-08-27 16:43 lp3318 阅读(175) 评论(0) 推荐(0)
摘要:要求: 给定一个无序数组arr,求出需要排序的最短子数组长度 1 // getMinLength.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 7 using namespace std; 8 9 阅读全文
posted @ 2016-08-23 20:50 lp3318 阅读(299) 评论(0) 推荐(0)
摘要:1.题目: 给定一个无序数组,其中元素 可正可负可0,给定一个k,求arr中所有的子数组累加和为k的最长子数组长度。 1 // maxLength.cpp : 定义控制台应用程序的入口点。 2 //未排序数组中累加和为指定值的最长子数组长度 3 //数组元素可正、可负、可0 4 5 #include 阅读全文
posted @ 2016-08-18 22:06 lp3318 阅读(344) 评论(0) 推荐(0)
摘要:可整合子数组:按由小到大排完序之后,后面的数比前一个数大1,如:[2,4,3,6,5]就是可整合数组。 1 // getLiL.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <ha 阅读全文
posted @ 2016-08-17 23:36 lp3318 阅读(215) 评论(0) 推荐(0)
摘要:1 /* 2 [1,-2,3,5,-2,6,-1]; 最大子数组为[3,5,-2,6] 和为12,并且能标记处最大子数组的范围 3 */ 4 5 6 #include "stdafx.h" 7 #include <iostream> 8 9 using namespace std; 10 11 vo 阅读全文
posted @ 2016-08-17 23:04 lp3318 阅读(167) 评论(0) 推荐(0)
摘要:str1 = “adabbca”; str2 = "abc"; str1中包含str2的子串有abbc,bca,其中bca为最终结果,返回3 1 // minLengthContain.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #incl 阅读全文
posted @ 2016-08-14 22:22 lp3318 阅读(255) 评论(0) 推荐(0)
摘要:1 // WaterPool.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <stdlib.h> 6 #include <vector> 7 #include <iterator> 8 #include <iostream> 阅读全文
posted @ 2016-08-14 15:10 lp3318 阅读(136) 评论(0) 推荐(0)
摘要:1.给定一个任意数组,和一个大小为w的窗口,该窗口从左到右依次滑动,得到窗口的每个状态下的最大值 1 // maxWindow.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <de 阅读全文
posted @ 2016-08-13 09:36 lp3318 阅读(153) 评论(0) 推荐(0)