题目链接:Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked...
More »
题目链接:Min StackDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) – Push element x onto stack. pop() – Removes ...
More »
题目链接:Find Minimum in Rotated Sorted Array IISuppose 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)....
More »
题目链接:Find Minimum in Rotated Sorted ArraySuppose 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).Fin...
More »
题目链接:Maximum Product SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [...
More »
题目链接:Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = “the sky is blue”,return “blue is sky the”.Update (2015-02-1...
More »
题目链接:Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an i...
More »
题目链接:Max Points on a LineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.这道题的要求是统计二维平面上最多有多少点在同一直线上。这是一道数学的问题,而且是计算几...
More »
题目链接:Sort ListSort a linked list in O(n log n) time using constant space complexity.这道题的要求是对链表进行排序,要求时间复杂度O(nlogn),并且常量空间复杂度。排序,时间复杂度要求O(nlogn),因此需要考虑分治思路的排序:归并排序或者快排。...
More »
题目链接:Insertion Sort ListSort a linked list using insertion sort.这道题的要求是对链表进行插入排序。插入排序,就是和玩扑克差不多,每次拿到一张新牌,会从一侧向另一侧查找,直到找到合适位置,将其插进去,并保证手中的牌仍有续。 直接插入 而对于链表,采用同样的操作...
More »