上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 29 下一页
摘要: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?判断一个链表是否存在环,维护快慢指针就可以,如果有环那么快指针一定会追上慢指针,代码... 阅读全文
posted @ 2015-11-03 22:47 eversliver 阅读(220) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a... 阅读全文
posted @ 2015-11-03 21:57 eversliver 阅读(241) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 注意题目要求合并 阅读全文
posted @ 2015-11-03 21:30 eversliver 阅读(335) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re... 阅读全文
posted @ 2015-11-03 21:09 eversliver 阅读(330) 评论(0) 推荐(0) 编辑
摘要: A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index.... 阅读全文
posted @ 2015-11-03 15:19 eversliver 阅读(276) 评论(0) 推荐(0) 编辑
摘要: Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri... 阅读全文
posted @ 2015-11-03 11:53 eversliver 阅读(234) 评论(0) 推荐(0) 编辑
摘要: Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文
posted @ 2015-11-01 22:44 eversliver 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 代码如下,一般10个生产者10个消费者拷贝1个g的文件大概在6s左右,速度还是不错的。 1 #include <semaphore.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <fcntl.h> 5 #include <pthre 阅读全文
posted @ 2015-11-01 16:38 eversliver 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 简单的一个whereis的实现,代码如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 void dir_scan(char *path, char *file, char * fileToSearch); 7 int ... 阅读全文
posted @ 2015-11-01 16:35 eversliver 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 以前没事的时候写的,c++写的,原理很简单,代码如下: 1 #include 2 #include 3 #include 4 #include 5 //#include 6 #include 7 #include 8 9 const int maxCodeNum =... 阅读全文
posted @ 2015-11-01 16:32 eversliver 阅读(2373) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 29 下一页