上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页

2014年12月2日

摘要: Median of Two Sorted Arrays There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall ru 阅读全文
posted @ 2014-12-02 18:28 Yu's Garden 阅读(7656) 评论(0) 推荐(2) 编辑

2014年11月29日

摘要: Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?SOLUTION 1:经典快慢指针问题。如果存在环... 阅读全文
posted @ 2014-11-29 23:21 Yu's Garden 阅读(561) 评论(0) 推荐(0) 编辑
摘要: Rotate ListGiven a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5... 阅读全文
posted @ 2014-11-29 23:11 Yu's Garden 阅读(485) 评论(0) 推荐(0) 编辑
摘要: Surrounded RegionsGiven a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's i... 阅读全文
posted @ 2014-11-29 22:08 Yu's Garden 阅读(1169) 评论(0) 推荐(0) 编辑
摘要: Sort ListSort a linked list in O(n log n) time using constant space complexity.使用Merge Sort, 空间复杂度是 O(logN) 因为使用了栈空间。SOLUTION 1:使用Merge Sort来解决问题。为什么不... 阅读全文
posted @ 2014-11-29 20:55 Yu's Garden 阅读(3513) 评论(4) 推荐(0) 编辑
摘要: Swap Nodes in Pairs Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as... 阅读全文
posted @ 2014-11-29 20:23 Yu's Garden 阅读(383) 评论(0) 推荐(0) 编辑

2014年11月28日

摘要: November 28, 2014 Leetcode全垒打!以此纪念。找工作的路还是很漫长。继续奋斗。有学长学姐们的督促,必须更加努力。http://mcds.cs.cmu.edu/?q=node/262013Chun Chen (Twitter, San Francisco, CA)Yiwen C... 阅读全文
posted @ 2014-11-28 16:27 Yu's Garden 阅读(2406) 评论(3) 推荐(0) 编辑
摘要: Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the followin... 阅读全文
posted @ 2014-11-28 16:20 Yu's Garden 阅读(12909) 评论(1) 推荐(2) 编辑

2014年11月27日

摘要: Text JustificationGiven an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) j... 阅读全文
posted @ 2014-11-27 21:58 Yu's Garden 阅读(722) 评论(0) 推荐(0) 编辑

2014年11月26日

摘要: Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand... 阅读全文
posted @ 2014-11-26 20:38 Yu's Garden 阅读(431) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页

导航