摘要: QuestionReverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5-... 阅读全文
posted @ 2015-10-28 22:08 树獭君 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Question1 1 1 1 1 01 0 1 0 0 11 0 1 0 0 11 1 0 1 1 11 is earth, 0 is water.i) count the number of 'islands' that the matrix has.ii) count the number o... 阅读全文
posted @ 2015-10-28 09:52 树獭君 阅读(178) 评论(0) 推荐(0) 编辑
摘要: QuestionImplementint sqrt(int x).Compute and return the square root ofx.Solution 1 -- O(log n)常规做法是用的binary search。注意这里mid一定要是long类型,否则mid * mid会溢出。 1... 阅读全文
posted @ 2015-10-28 08:37 树獭君 阅读(275) 评论(0) 推荐(0) 编辑
摘要: QuestionMedian is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of... 阅读全文
posted @ 2015-10-28 03:27 树獭君 阅读(254) 评论(0) 推荐(0) 编辑