Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:
其他好文 时间:
2015-08-02 13:09:31
阅读次数:
106
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a...
分类:
其他好文 时间:
2015-08-01 23:29:05
阅读次数:
146
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m...
分类:
其他好文 时间:
2015-08-01 23:25:15
阅读次数:
161
Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a sort...
分类:
其他好文 时间:
2015-08-01 23:22:32
阅读次数:
155
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes...
分类:
其他好文 时间:
2015-08-01 23:17:36
阅读次数:
108
Given 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-12):For C prog...
分类:
其他好文 时间:
2015-08-01 21:59:34
阅读次数:
122
Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express...
分类:
其他好文 时间:
2015-08-01 21:45:38
阅读次数:
89
Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line./** * Definition for a point. * class Point { * i...
分类:
其他好文 时间:
2015-08-01 20:26:30
阅读次数:
118
Sort a linked list inO(nlogn) time using constant space complexity./** * Definition for singly-linked list. * public class ListNode { * int val; *...
分类:
其他好文 时间:
2015-08-01 18:42:38
阅读次数:
108
Sort a linked list using insertion sort./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * L...
分类:
其他好文 时间:
2015-08-01 18:35:22
阅读次数:
101