Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
题目的意思是判断链表中有没有环
思路:
定义两个指针,一个慢指针,一个快指针,慢指针一次走两步,快指针一次走一步,如果有环,那么慢、快指针一...
分类:
其他好文 时间:
2014-12-26 20:20:32
阅读次数:
191
题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?代码:oj在线测试通过Runtime:416 ms 1 # Definitio...
分类:
编程语言 时间:
2014-12-26 16:37:09
阅读次数:
220
记得曾经写脚本按照天为单位进行循环,循环的其实日期可以是任何一天,像这样: 1 START_DAY=$(date -d "$TODAY -1days" +%Y%m%d); 2 3 END_DAY=$(date -d "$TODAY -${cycle}days" +%Y%m%d); 4 5 for.....
分类:
系统相关 时间:
2014-12-25 19:58:21
阅读次数:
206
本篇文章由:http://www.sollyu.com/android-software-development-webview-addjavascriptinterface-cycle-of-gradual-one/说明文章列表android软件开发之webView.addJavascriptIn...
分类:
移动开发 时间:
2014-12-25 14:19:17
阅读次数:
227
本篇文章由:http://www.sollyu.com/android-software-development-webview-addjavascriptinterface-cycle-of-gradual-two/说明文章列表android软件开发之webView.addJavascriptIn...
分类:
移动开发 时间:
2014-12-25 14:15:59
阅读次数:
221
微软近期Open的职位:Do you want to work on a fast-cycle, high visibility, hardcore search team with ambitious goals? Internet search is one of the highest imp...
分类:
其他好文 时间:
2014-12-23 23:53:51
阅读次数:
279
微软近期Open的职位:Do you want to work on a fast-cycle, high visibility, hardcore search team with ambitious goals? Internet search is one of the highest imp...
分类:
其他好文 时间:
2014-12-23 12:16:55
阅读次数:
116
微软近期Open的职位:Do you want to work on a fast-cycle, high visibility, hardcore search team with ambitious goals? Internet search is one of the highest imp...
分类:
其他好文 时间:
2014-12-22 12:39:16
阅读次数:
164
微软近期Open的职位:Do you want to work on a fast-cycle, high visibility, hardcore search team with ambitious goals? Internet search is one of the highest imp...
分类:
其他好文 时间:
2014-12-22 00:48:20
阅读次数:
229
一、原题
Linked List Cycle
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
二、分析
选用两个指针扫描链表,一个速度快,一个速度慢,若两个指针相遇,说明有环。
三、...
分类:
其他好文 时间:
2014-12-18 20:44:05
阅读次数:
157