题目描述: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....
分类:
其他好文 时间:
2014-10-17 01:12:13
阅读次数:
279
Add Date 2014-10-15Find 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 7mi...
分类:
编程语言 时间:
2014-10-17 00:31:13
阅读次数:
233
Pythonfloat("inf")// delete an element in listA = ["a","b"]Del A[0]A.remove("a")// python timeit modulehttp://woodpecker.org.cn/diveintopython/perform...
分类:
编程语言 时间:
2014-10-16 22:40:33
阅读次数:
387
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.这题和sort list等题都比较相似,需要先用快慢指针的方法找到链表的中点,然后...
分类:
其他好文 时间:
2014-10-16 22:31:43
阅读次数:
217
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:
其他好文 时间:
2014-10-16 14:04:12
阅读次数:
178
很眼熟。。。就是一个二分。。。class Solution {public: int findMin(vector &num) { int size = num.size() - 1; int l = 0; int r = size; w...
分类:
其他好文 时间:
2014-10-16 12:35:22
阅读次数:
180
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...
分类:
其他好文 时间:
2014-10-16 12:24:52
阅读次数:
225
https://oj.leetcode.com/problems/merge-sorted-array/归并排序的一步操作,需要事先把A[]的元素移到数组末端,前段空出来填充结果。需要注意的是如果从0~m的转移会在n比较小的时候有问题。所以要从m~0转移。使用memcpy在GCC下就是从0~m开始转...
分类:
编程语言 时间:
2014-10-15 23:05:41
阅读次数:
202
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing
together the nodes of the first two lists.
class Solution {
public:
ListNode *mergeTwoLists(Li...
分类:
其他好文 时间:
2014-10-15 15:48:31
阅读次数:
127
https://oj.leetcode.com/problems/search-in-rotated-sorted-array/一个被旋转的数组,要求二分搜索查询一个数。修改二分搜索可以完成。注意可以通过A[l]A[r]时,中间有一个间断点。可以通过A[mid]>A[r]来判断中点与旋转中心的位置关...
分类:
编程语言 时间:
2014-10-14 05:02:17
阅读次数:
222