码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
【leetcode】Search Insert Position
题目是这样的: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inser....
分类:其他好文   时间:2015-01-21 18:08:27    阅读次数:177
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 run time complexity should be O(log (m+n)).   最后从medianof two sorted arrays中看到...
分类:其他好文   时间:2015-01-21 16:31:27    阅读次数:123
[leetcode] Remove Duplicates from Sorted Array
题意:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space fo...
分类:其他好文   时间:2015-01-21 01:18:09    阅读次数:325
Leetcode Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:其他好文   时间:2015-01-20 22:10:55    阅读次数:180
[LeetCode] Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路:递归的思路。思路与重建二叉树类似。时间复杂度O(n), 空间复杂度O(logN) 1 /** 2 ....
分类:其他好文   时间:2015-01-20 22:00:43    阅读次数:170
Python中sorted()方法的用法
1.先说一下iterable,中文意思是迭代器。Python的帮助文档中对iterable的解释是:iteralbe指的是能够一次返回它的一个成员的对象。iterable主要包括3类:第一类是所有的序列类型,比如list(列表)、str(字符串)、tuple(元组)。第二类是一些非序列类型,比如di...
分类:编程语言   时间:2015-01-20 20:19:14    阅读次数:227
LeetCode-Search in Rotated Sorted Array II
Analysis:For target>A[mid]:There is only one case that we should seach [start,mid-1]: Peak is in the left, i.e., A[start]>A[mid] && target>=A[start].F...
分类:其他好文   时间:2015-01-20 07:49:37    阅读次数:203
[LeetCode] Maximum Gap 求最大间距
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-01-19 23:32:53    阅读次数:234
python sorted
http://www.cnblogs.com/65702708/archive/2010/09/14/1826362.htmlpython sorted我们需要对List进行排序,Python提供了两个方法对给定的List L进行排序,方法1.用List的成员函数sort进行排序方法2.用built...
分类:编程语言   时间:2015-01-19 23:30:56    阅读次数:203
leetcode----------Merge Sorted Array
题目Merge Sorted Array通过率30.7%难度EasyGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough sp...
分类:其他好文   时间:2015-01-19 20:46:52    阅读次数:115
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!