文章
【leetcode】31. Next Permutation 数字序列的所有组合中比给定串大的下一个最小的串
1.题目Implementnextpermutation,whichrearrangesnumbersintothelexicographicallynextgreaterpermutationofnumbers.Ifsucharrangementi
Leetcode 15 3 sum
这道题的复杂度是O(n^2)。问题是这样的,如果我取中间,然后再左右各取的话,去重虽然不会增加复杂度,但是最后leetcode结果还是会超时。最后优化的解法是这样的,取最左边的值,然后在取两个后面的值,这样可以用一些技巧去重,不用再单独去重了<pre<codepublicclass
【leetcode】30. Substring with Concatenation of All Words 精确匹配的子串集
1.题目Youaregivenastring,s,andalistofwords,words,thatareallofthesamelength.Findallstartingindicesofsubstring(s)insthat
【leetcode】29. Divide Two Integers 不能使用乘除法的整数除法
1.题目Dividetwointegerswithoutusingmultiplication,divisionandmodoperator.Ifitisoverflow,returnMAX_INT.2.思路这题的异常考虑点的坑很多。
【leetcode】28. Implement strStr() 字符串匹配KMP BM
1.题目ImplementstrStr().Returnstheindexofthefirstoccurrenceofneedleinhaystack,or1ifneedleisnotpartofhaystack.2.思路
【leetcode】27. Remove Element 删除数组指定值的元素
1.题目Givenanarrayandavalue,removeallinstancesofthatvalueinplaceandreturnthenewlength.Donotallocateextraspaceforanother
【leetcode】26. Remove Duplicates from Sorted Array 删除有序数组的重复元素
1.题目Givenasortedarray,removetheduplicatesinplacesuchthateachelementappearonlyonceandreturnthenewlength.Donotallocateex
【leetcode】25. Reverse Nodes in k-Group 链表按K分段逆序
1.题目Givenalinkedlist,reversethenodesofalinkedlistkatatimeandreturnitsmodifiedlist.Ifthenumberofnodesisnotamultiple
【leetcode】24. Swap Nodes in Pairs 链表奇偶节点交换
1.题目Givenalinkedlist,swapeverytwoadjacentnodesandreturnitshead.Forexample,Given1>2>3>4,youshouldreturnthelist
【leetcode】23. Merge k Sorted Lists 多个有序链表的合并有序
1.题目Mergeksortedlinkedlistsandreturnitasonesortedlist.Analyzeanddescribeitscomplexity.2.思路第一反应是采用败者树的merge模式,但是败者树的数据
已加载文章中没有匹配内容,试试其他关键词或清空搜索。