个人博客:https://luxialan.com

上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页
摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文
posted @ 2014-12-06 19:58 luxialan 阅读(125) 评论(0) 推荐(0)
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... 阅读全文
posted @ 2014-12-06 16:18 luxialan 阅读(107) 评论(0) 推荐(0)
摘要: 求数组中某个出现n次的数是一类很有技巧的问题,这类问题思路巧妙,但是一旦想到思路,编程异常简单快速。这求出现n次的数问题可以归结为下列常见的三个问题:问题1:数组中只有一个数出现一次,其余的数出现2次,求这个出现一次的数是多少。问题2:数组中只有一次数出现一次,其余的数出现3次,求这个出现一次的数是... 阅读全文
posted @ 2014-12-06 09:28 luxialan 阅读(158) 评论(0) 推荐(0)
摘要: 插入排序:稳定最优时间复杂度:O(n) 此时数列顺序排列最差时间复杂度:O(n^2) 此时数列逆序排列插入排序的思想:固定一个元素a,分别比较a之前的元素,如果a之前的元素比a大,则元素后移,将a插入比a小的元素后面。要理解插入排序,实际上递归和不递归的思想是个相反的过程,递归的最后一层相当... 阅读全文
posted @ 2014-11-06 19:55 luxialan 阅读(118) 评论(0) 推荐(0)
摘要: “概率模型与计算机视觉”林达华美国麻省理工学院(MIT)博士 上世纪60年代,Marvin Minsky在MIT让他的本科学生Gerald Jay Sussman用一个暑假的时间完成一个有趣的Project: “link a camera to a computer and get the com... 阅读全文
posted @ 2014-11-03 09:32 luxialan 阅读(207) 评论(0) 推荐(0)
摘要: 题目:输入一个整数和一棵二元树。从树的根结点开始往下访问一直到叶结点所经过的所有结点形成一条路径。打印出和与输入整数相等的所有路径。例如输入整数22和如下二元树 10 / \ 5 12 / \ 4 7则打印出两条路径:10, 12和10, 5, 7。思路十分简单,深搜,在每点判断和是否为22且... 阅读全文
posted @ 2014-11-03 09:05 luxialan 阅读(129) 评论(0) 推荐(0)
摘要: 聪明的kk时间限制:1000ms | 内存限制:65535KB难度:3描述聪明的“KK”非洲某国展馆的设计灵感源于富有传奇色彩的沙漠中陡然起伏的沙丘,体现出本国不断变换和绚丽多彩的自然风光与城市风貌。展馆由五部分组成,馆内影院播放名为《一眨眼的瞬间》的宽银幕短片,反映了建国以来人民生活水平和城市居住... 阅读全文
posted @ 2014-11-01 15:54 luxialan 阅读(140) 评论(0) 推荐(0)
摘要: 矩形嵌套时间限制:3000ms | 内存限制:65535KB难度:4描述有n个矩形,每个矩形可以用a,b来描述,表示长和宽。矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a#includeusing namespace std;struct ret{ int x; int y;};bool c... 阅读全文
posted @ 2014-10-31 09:17 luxialan 阅读(247) 评论(0) 推荐(0)
摘要: Maximum Depth of Binary TreeTotal Accepted:36406Total Submissions:83130Given a binary tree, find its maximum depth.The maximum depth is the number of ... 阅读全文
posted @ 2014-10-29 21:16 luxialan 阅读(120) 评论(0) 推荐(0)
摘要: 单调递增最长子序列时间限制:3000ms | 内存限制:65535KB难度:4描述求一个字符串的最长递增子序列的长度如:dabdbf最长递增子序列就是abdf,长度为4输入第一行一个整数0#includeint main(){ int m,n,r,i,j; char a[10001]; int s[... 阅读全文
posted @ 2014-10-29 13:11 luxialan 阅读(143) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页