题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题解:这道题连带着II是很经典的,在看CC150时候,纠结这个问题纠结了很久....
分类:
编程语言 时间:
2014-07-23 12:02:26
阅读次数:
311
Problem: Implement a function to check if a singly linked list is a palindrome.思路:最简单的方法是 Reverse and compare.另外一种非常经典的办法是用 Recursive 的思路,把一个list看成这种形...
分类:
其他好文 时间:
2014-07-16 17:41:23
阅读次数:
188
pros:1. 韩顺平课结束,择日开始做weidou吧。。。2. 跟上了地里的刷cc150题的进度3. 马上就要拿到第一张coursera的证书啦*^__^*4. 签证,机票解决cons:1. leetcode很久没动了。。。2. coursera上的公开课有点掉队,这礼拜要补上3. 隐形眼镜,眼镜...
分类:
其他好文 时间:
2014-07-03 11:26:29
阅读次数:
154
Implement an algorithm to print all valid (
properly opened and closed) combinations of n-pairs of parentheses.思路:比如 n = 3,
((())) 就是一个valid combinati...
分类:
其他好文 时间:
2014-06-11 13:19:00
阅读次数:
306
Write an algorithm to print all ways of arranging
eight queens on an 8*8 chess board so that none of them share the same row,
column or diagonal.思路:本质...
分类:
其他好文 时间:
2014-06-10 10:36:29
阅读次数:
182
Given an infinite number of quarters (25 cents),
dimes (10 cents), nickels (5 cents) and pennies (1 cent), find how many ways to
represent n cents.思路:...
分类:
其他好文 时间:
2014-06-09 20:04:56
阅读次数:
238
Problem: Given a two-dimensional graph with
points on it, find a line which passes the most number of points.此题是Cracking the
code 5th edition 第七章第六题,思...
分类:
其他好文 时间:
2014-05-29 08:10:38
阅读次数:
292