上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页

2015年5月27日

摘要: Title: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 分析:首先要注意的是,输入数组中可能有重复的点。由于两点确定一条直线,一个很直观的解法 阅读全文
posted @ 2015-05-27 21:06 月下之风 阅读(203) 评论(0) 推荐(0) 编辑

2015年5月26日

摘要: Title: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum e 阅读全文
posted @ 2015-05-26 13:24 月下之风 阅读(202) 评论(0) 推荐(0) 编辑
摘要: Title: Sort a linked list using insertion sort. 阅读全文
posted @ 2015-05-26 10:44 月下之风 阅读(134) 评论(0) 推荐(0) 编辑

2015年5月25日

摘要: 展示一下使用指针的指针和指针的引用修改传递给方法的指针,以便更好的使用它。(这里说的指针的指针不是一个二维数组)为什么需要使用它们当我们把一个指针做为参数传一个方法时,其实是把指针的复本传递给了方法,也可以说传递指针是指针的值传递。如果我们在方法内部修改指针会出现问题,在方法里做修改只是修改的指针的... 阅读全文
posted @ 2015-05-25 14:55 月下之风 阅读(241) 评论(0) 推荐(0) 编辑
摘要: Title: Sort a linked list in O(n log n) time using constant space complexity. 思路:考虑快速排序和归并排序,但是我的快速排序超时了 归并排序。两种思路,一个得到全部长度之后,进行。另一种使用快慢指针 阅读全文
posted @ 2015-05-25 14:49 月下之风 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Title: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - 阅读全文
posted @ 2015-05-25 10:41 月下之风 阅读(158) 评论(0) 推荐(0) 编辑

2015年5月24日

摘要: Title: 思路:使用快慢指针,当快指针指向链表尾部时,将慢指针所指即以后反转,再将前后两个链表合并 阅读全文
posted @ 2015-05-24 13:46 月下之风 阅读(141) 评论(0) 推荐(0) 编辑
摘要: I title: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 思路: 使用两个指针slow,fast。两个指针都从表头开始走 阅读全文
posted @ 2015-05-24 10:17 月下之风 阅读(149) 评论(0) 推荐(0) 编辑

2015年5月23日

摘要: I title: https://leetcode.com/problems/word-break/ Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separ 阅读全文
posted @ 2015-05-23 22:38 月下之风 阅读(212) 评论(0) 推荐(0) 编辑
摘要: I title: Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtim 阅读全文
posted @ 2015-05-23 18:44 月下之风 阅读(181) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页

导航