【题目描述】Givenalistofnumbers,returnallpossiblepermutations.Notice:Youcanassumethatthereisnoduplicatenumbersinthelist.给定一个数字列表,返回其所有可能的排列。注意:你可以假设没有重复数字。【题目链接】http://www.lintcode.com/en/problem/permutations/【题目解..
分类:
其他好文 时间:
2017-04-28 12:01:42
阅读次数:
145
【题目描述】Foragivensourcestringandatargetstring,youshouldoutputthefirstindex(from0)oftargetstringinsourcestring.Iftargetdoesnotexistinsource,justreturn-1.对于一个给定的source字符串和一个target字符串,你应该在source字符串中找出target字符串出现的第一个位置(..
分类:
其他好文 时间:
2017-04-25 21:25:32
阅读次数:
155
DescriptionSuppose 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).Find the minimum ...
分类:
其他好文 时间:
2017-04-25 11:38:34
阅读次数:
236
4/23/2017 算法班 注意返回的是值,而不是index ...
分类:
其他好文 时间:
2017-04-24 10:19:01
阅读次数:
158
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f ...
分类:
其他好文 时间:
2017-04-24 10:09:42
阅读次数:
187
DescriptionGiven a big sorted array with positive integers sorted by ascending order. The array is so big so that you can not get the length of the wh ...
分类:
其他好文 时间:
2017-04-24 10:04:20
阅读次数:
131
DescriptionGiven a target number and an integer array A sorted in ascending order, find the index i in A such that A[i] is closest to the given target ...
分类:
其他好文 时间:
2017-04-24 09:57:07
阅读次数:
105
【题目描述】MergetwogivensortedintegerarrayAandBintoanewsortedintegerarray.合并两个排序的整数数组A和B变成一个新的数组。【题目链接】http://www.lintcode.com/en/problem/merge-two-sorted-arrays/【题目解析】A和B都已经是排好序的数组,我们只需要从后往前比较就可以..
分类:
其他好文 时间:
2017-04-16 10:12:51
阅读次数:
137
【题目描述】FindK-thlargestelementinanarray.Notice:Youcanswapelementsinthearray在数组中找到第k大的元素注意:你可以交换数组中的元素的位置【题目链接】http://www.lintcode.com/en/problem/kth-largest-element/【题目解析】sort的方法:一开始看到这道题肯定觉得很简单..
分类:
其他好文 时间:
2017-04-13 15:42:51
阅读次数:
114
【题目描述】Countthenumberofk‘sbetween0andn.kcanbe0-9.计算数字k在0到n中的出现的次数,k可能是0~9的一个值。【题目链接】http://www.lintcode.com/en/problem/digit-counts/【题目解析】方法一:BruteForce,0到n个数挨个算过去。最大的问题就是效率,当n非常大时,就需要很..
分类:
其他好文 时间:
2017-04-09 21:22:45
阅读次数:
218