E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
lintCode
[
LintCode
] Longest Palindrome
ProblemGivenastringwhichconsistsoflowercaseoruppercaseletters,findthelengthofthelongestpalindromesthatcanbebuiltwiththoseletters.Thisiscasesensitive,forexample"Aa"isnotconsideredapalindromehere.Notice
linspiration
·
2018-01-16 00:00
string
palindrome
LintCode
java
[
LintCode
] Amicable Pair
ProblemAnamicablepair(m,n)consistsoftwointegersm,nforwhichthesumofproperdivisors(thedivisorsexcludingthenumberitself)ofonenumberequalstheother.Givenanintegerk,findallamicablepairsbetween1andk.NoticeFo
linspiration
·
2018-01-12 00:00
LintCode
enumeration
java
剑指Offer(三):从尾到头打印链表
3.刚开始准备刷LeetCode、
LintCode
,突然看见一个大神研究生正在刷这个系列,故跟着大神学习。4.在别人基础之上进行部分优化,总结自己的观点。问题:输入一个链表,返回一个反序的链表。
影醉阏轩窗
·
2018-01-11 14:00
Java 算法-编辑距离(动态规划)
今天又在
lintCode
上面做了一道动态规划的题了,不知道是不是因为自己太久没有做题了,所以感觉没什么思路了。不要颓废!在这里督促自己!
琼珶和予
·
2018-01-11 10:20
lintcode
6-6. 合并排序数组
合并两个排序的整数数组A和B变成一个新的数组。您在真实的面试中是否遇到过这个题?Yes样例给出A=[1,2,3,4],B=[2,4,5,6],返回[1,2,2,3,4,4,5,6]挑战你能否优化你的算法,如果其中一个数组很大而另一个数组很小?标签相关题目classSolution{public:/**@paramA:sortedintegerarrayA*@paramB:sortedinteger
长风o
·
2018-01-10 21:51
LintCode编程
Leetcode 常见bug总结
647.SubstringAnagramsGivenastringsandanon-emptystringp,findallthestartindicesofp’sanagramsins.
LintCode
二啸
·
2018-01-10 00:34
Leetcode
总结
[
LintCode
] K Closest Points
ProblemGivensomepointsandapointoriginintwodimensionalspace,findkpointsoutofthesomepointswhicharenearesttoorigin.Returnthesepointssortedbydistance,iftheyaresamewithdistance,sortedbyx-axis,otherwisesort
linspiration
·
2018-01-09 00:00
math
java
priority-queue
heap
comparator
单词拆分I
样例:给出s="
lintcode
"dict=["lint","code"]返回true因为"
lintcode
"可以被空格切分成"
lintcode
"思路:用res[i]代表字符串s的到第i个元素为止能不能用字典中的值来表示
wydong
·
2018-01-07 00:00
算法
动态规划
[LeetCode/
LintCode
] Top K Frequent Words
LeetCodeversionProblemGivenanon-emptylistofwords,returnthekmostfrequentelements.Youranswershouldbesortedbyfrequencyfromhighesttolowest.Iftwowordshavethesamefrequency,thenthewordwiththeloweralphabetica
linspiration
·
2018-01-07 00:00
hashmap
java
mapreduce
Lintcode
139 Subarray Sum Closest solution 题解
【题目链接】www.
lintcode
.com/en/prob
AdmondGuo
·
2018-01-01 22:30
lintcode
面试题
Lintcode
138 Subarray Sum solution 题解
【题目描述】Givenanintegerarray,findasubarraywherethesumofnumbersiszero.Yourcodeshouldreturntheindexofthefirstnumberandtheindexofthelastnumber.Notice:Thereisatleastonesubarraythatit'ssumequalstozero.给定一个整数数
AdmondGuo
·
2017-12-30 13:52
lintcode
面试题
[
LintCode
] Top k Largest Numbers I
ProblemGivenanintegerarray,findthetopklargestnumbersinit.ExampleGiven[3,10,1000,-99,4,100]andk=3.Return[1000,100,10].TagsHeapPriorityQueueSolutionpublicclassSolution{publicint[]topk(int[]nums,intk){//
linspiration
·
2017-12-30 00:00
comparator
heap
priority-queue
java
[
LintCode
] Insert Node in Sorted Linked List
ProblemInsertanodeinasortedlinkedlist.ExampleGivenlist=1->4->6->8andval=5.Return1->4->5->6->8.SolutionpublicclassSolution{publicListNodeinsertNode(ListNodehead,intval){ListNodedummy=newListNode(0);dum
linspiration
·
2017-12-29 00:00
linkedlist
LintCode
java
[
LintCode
] Implement Stack (using ListNode)
ProblemImplementastack.Youcanuseanydatastructureinsideastackexceptstackitselftoimplementit.Examplepush(1)pop()push(2)top()//return2pop()isEmpty()//returntruepush(3)isEmpty()//returnfalseSolutionclassL
linspiration
·
2017-12-29 00:00
LintCode
linkedlist
java
[
LintCode
] String Compression
StringCompressionImplementamethodtoperformbasicstringcompressionusingthecountsofrepeatedcharacters.Forexample,thestringaabcccccaaawouldbecomea2b1c5a3.Ifthe"compressed"stringwouldnotbecomesmallerthanth
linspiration
·
2017-12-29 00:00
LintCode
java
[
LintCode
] Substring Anagrams
ProblemGivenastringsandanon-emptystringp,findallthestartindicesofp'sanagramsins.StringsconsistsoflowercaseEnglishlettersonlyandthelengthofbothstringssandpwillnotbelargerthan40,000.Theorderofoutputdoes
linspiration
·
2017-12-29 00:00
LintCode
java
单词拆分II
Lintcode
582已知:给一字串s和单词的字典dict,在字串中增加空格来构建一个句子,并且所有单词都来自字典。返回所有有可能的句子。
Mio_Bass
·
2017-12-22 15:27
Lintcode
剑指Offer(二):替换空格
3.刚开始准备刷LeetCode、
LintCode
,突然看见一个大神研究生正在刷这个系列,故跟着大神学习。4.在别人基础之上进行部分优化,总结自己的观点。
影醉阏轩窗
·
2017-12-21 07:00
(
lintcode
)第31题,数组划分
给出一个整数数组 nums 和一个整数 k。划分数组(即移动数组 nums 中的元素),使得:所有小于k的元素移到左边所有大于等于k的元素移到右边返回数组划分的位置,即数组中第一个位置i,满足nums[i]大于等于k。注意事项你应该真正的划分数组nums,而不仅仅只是计算比k小的整数数,如果数组nums中的所有元素都比k小,则返回nums.length。样例给出数组nums=[3,2,2,1]和k
秦怀
·
2017-12-19 21:30
lintcode
数组划分
lintcode
(
lintcode
)第30题 插入区间
给出一个无重叠的按照区间起始端点排序的区间列表。在列表中插入一个新的区间,你要确保列表中的区间仍然有序且不重叠(如果有必要的话,可以合并区间)。样例插入区间[2,5]到[[1,2],[5,9]],我们得到[[1,9]]。插入区间[3,4]到[[1,2],[5,9]],我们得到[[1,2],[3,4],[5,9]]。思路:先加入list正确的位置,再合并可以合并的项,代码写得烂且长,谅解。/***D
秦怀
·
2017-12-19 13:18
lintcode
剑指offer(一):二维数组中的查找
3.刚开始准备刷LeetCode、
LintCode
,突然看见一个大神博客,同为研究僧为啥差别那么大呢?4.在别人基础之上进行部分优化,总结自己的观点。
影醉阏轩窗
·
2017-12-19 10:00
[
LintCode
] Add Two Numbers II
ProblemYouhavetwonumbersrepresentedbyalinkedlist,whereeachnodecontainsasingledigit.Thedigitsarestoredinforwardorder,suchthatthe1'sdigitisattheheadofthelist.Writeafunctionthataddsthetwonumbersandreturn
linspiration
·
2017-12-19 00:00
linkedlist
LintCode
Lintcode
130 Heapify solution 题解
【题目描述】Givenanintegerarray,heapifyitintoamin-heaparray.ForaheaparrayA,A[0]istherootofheap,andforeachA[i],A[i2+1]istheleftchildofA[i]andA[i2+2]istherightchildofA[i].给出一个整数数组,堆化操作就是把它变成一个最小堆数组。对于堆数组A,A[0
Joy97
·
2017-12-18 13:11
刷题
Lintcode
128 Hash Function solution 题解
【题目描述】IndatastructureHash,hashfunctionisusedtoconvertastring(oranyothertype)intoanintegersmallerthanhashsizeandbiggerorequaltozero.Theobjectiveofdesigningahashfunctionisto"hash"thekeyasunreasonableasp
Joy97
·
2017-12-16 23:27
刷题
Java 算法-最长上升序列(动态规划或二分法)
今天在
lintCode
上面做了一道关于二分法的题,觉得有必要记录下来。1.概览(1).题意给定一个整数序列,找到最长上升子序列(LIS),返回LIS的长度。
琼珶和予
·
2017-12-16 01:53
LintCode
python 简单题-627最长回文串
给出一个包含大小写字母的字符串。求出由这些字母构成的最长的回文串的长度是多少。数据是大小写敏感的,也就是说,"Aa"并不会被认为是一个回文串。注意事项假设字符串的长度不会超过1010。您在真实的面试中是否遇到过这个题?样例给出s="abccccdd"返回7一种可以构建出来的最长回文串方案是"dccaccd"。classSolution:"""@param:s:astringwhichconsist
jova_y
·
2017-12-11 07:42
LintCode
125. Backpack II
原题
LintCode
125.BackpackIIDescriptionGivennitemswithsizeAiandvalueVi,andabackpackwithsizem.What'sthemaximumvaluecanyouputintothebackpack
Andiedie
·
2017-12-11 06:32
Lintcode
191 Maximum Product Subarray solution 题解
【题目链接】www.
lintcode
.com/en/problem/maximum-product-subarray/【题目解析】本题其实是Maxim
程风破浪会有时
·
2017-12-11 02:41
Coin Change II
CoinChange–
Lintcode
740已知:给我们一个总额amount和一个字符串,字符串内的数字可以循环使用,求让数字总和为amount的数字串的总个数示例:amount=10,coins[]=
Mio_Bass
·
2017-12-10 17:20
Lintcode
lintcode
5 寻找第k大数
5.在数组中找到第k大的元素在数组中找到第k大的元素参考先排序,再查找。最简单,但是最麻烦,如果不止一次的使用数组中的第k大元素,那么可以先排序,以备后面继续使用。冒泡和选择使用冒泡和选择算法,直到排好了第k大元素以后结束。冒泡:从后向前,对比。快速排序的思想快排中,选取一个分割元素,然后交换两边元素直到分割元素左边大于右边(或相反),那么此时,这个分割元素就已经排好序了,对比分割元素的下标,可以
Myth52125
·
2017-12-10 14:02
前K个数的和
From九章算法:https://aaronice.gitbooks.io/
lintcode
/content/data_structure/top_k_largest_numbers.htmlwoc..
98Future
·
2017-12-10 01:03
Lintcode
123 Word Search solution 题解
【题目描述】Givena2Dboardandaword,findifthewordexistsinthegrid.Thewordcanbeconstructedfromlettersofsequentiallyadjacentcell,where"adjacent"cellsarethosehorizontallyorverticallyneighboring.Thesamelettercellm
Joy97
·
2017-12-08 21:41
刷题
lintcode
刷题总结
动态规划111.爬楼梯思路类似斐波那契数列注意考虑第0阶的特殊情况272.爬楼梯II思路类似上题,只是从两个变量变成了三个变量,注意特判下第0、1、2三阶台阶630.骑士的最短路径II思路骑士只能从左往右移动,所以从(0,0)点出发沿着方向坐标先更新最左列数组,逐渐向右更新,直到(n-1,m-1)的位置注意对上一个点值和坐标是否越界的判断注意书写的正确116.跳跃游戏思路当前位置i是否可达由其前面
6默默Welsh
·
2017-12-08 19:59
Lintcode
122 Largest Rectangle In Histogram solutio
【题目描述】Givennnon-negativeintegersrepresentingthehistogram'sbarheightwherethewidthofeachbaris1,findtheareaoflargestrectangleinthehistogram.Aboveisahistogramwherewidthofeachbaris1,givenheight=[2,1,5,6,2,
Joy97
·
2017-12-07 19:58
刷题;lintcode
422. 最后一个单词的长度
从后向前遍历直接从后向前遍历,遇见字母计数器加1,遇见空格的话检查计数器,如果计数器有值(大于0),那么直接返回,如果遍历结束都没有遇到空格那么先检查num是否大于0(
lintcode
的测试库竟然没有这种数据
和蔼的zhxing
·
2017-12-06 20:32
LintCode
删除数字
题目给出一个字符串A,表示一个n位正整数,删除其中k位数字,使得剩余的数字仍然按照原来的顺序排列产生一个新的正整数。找到删除k个数字之后的最小正整数。N1&&sb.charAt(0)=='0')sb.delete(0,1);returnsb.toString();}}
六尺帐篷
·
2017-12-06 04:35
Lintcode
34 N-Queens II solution 题解
【题目链接】http://www.
lintcode
.com/en/problem/n-queens-
代码码着玩
·
2017-12-06 04:52
LintCode
最小调整代价
题目给一个整数数组,调整每个数的大小,使得相邻的两个数的差小于一个给定的整数target,调整每个数的代价为调整前后的差的绝对值,求调整代价之和最小是多少。注意事项你可以假设数组中每个整数都是正整数,且小于等于100。样例对于数组[1,4,2,3]和target=1,最小的调整方案是调整为[2,3,2,3],调整代价之和是2。返回2。分析动态规划,一个元素一个元素的调整,由于是要求相邻元素的差值,
六尺帐篷
·
2017-12-06 01:28
OJ:
lintcode
经典二分查找问题
在一个排序数组中找一个数,返回该数出现的任意位置,如果不存在,返回-1您在真实的面试中是否遇到过这个题?Yes样例�给出数组[1,2,2,4,5,5].对于target=2,�返回1或者2.对于target=5,�返回4或者5.对于target=6,�返回-1.classSolution{public:/***@paramAanintegerarraysortedinascendingorder*
DayDayUpppppp
·
2017-12-05 21:24
LintCode
矩阵的之字型遍历
题目给你一个包含mxn个元素的矩阵(m行,n列),求该矩阵的之字型遍历。样例对于如下矩阵:[[1,2,3,4],[5,6,7,8],[9,10,11,12]]返回[1,2,5,9,6,3,4,7,10,11,8,12]分析弄清楚遍历的规则然后依次实现就好了代码publicclassSolution{/***@parammatrix:amatrixofintegers*@return:anarray
六尺帐篷
·
2017-12-05 02:48
LintCode
: 109. 数字三角形 Java
题目大意给定一个数字三角形,找到从顶部到底部的最小路径和。每一步可以移动到下面一行的相邻数字上。注意事项如果你只用额外空间复杂度O(n)的条件下完成可以获得加分,其中n是数字三角形的总行数。样例比如,给出下列数字三角形:[[2],[3,4],[6,5,7],[4,1,8,3]]从顶到底部的最小路径和为11(2+3+5+1=11)。解题思路总路径最小,则被包含路径之和最小(倒推,顺推不成立)。pub
two_star
·
2017-12-04 16:19
java
LintCode
动态规划
LintCode
492 [Implement Queue by Linked List]
原题实现一个队列的操作样例enqueue(1)enqueue(2)enqueue(3)dequeue()#return1enqueue(4)dequeue()#return2解题思路简单基础的一道题,用链表实现列队注意,dequeue的时候如果是下面这种情况,head指向dummyNode,tail指向5。把5删除之后要记得将tail重新指向head所指向的nodeDummyNode->5->Nu
Jason_Yuan
·
2017-12-03 07:30
Longest Common Subsequence
LintCode
77.LongestCommonSubsequenceAlgorithmTwoinputstringawithlengthlengthAandbwithlengthlengthBlookup
宋翰要长肉
·
2017-12-03 03:52
LintCode
之35 翻转链表
题目来源:翻转链表题目描述:翻转一个链表样例:给出一个链表1->2->3->null,这个翻转后的链表为3->2->1->nullJava代码:publicListNodereverse(ListNodehead){//writeyourcodehereintcount=0;int[]xulie=newint[1000];ListNodelistNode=head;while(listNode!=
Guoshi_Wan
·
2017-11-30 23:56
LintCode刷题
Lintcode
2: 尾部的零
设计一个算法,计算出n阶乘中尾部零的个数解析:仔细分析这个题,n!=1*2*,,,,,*n要产生0,就要有5,但是坑就在有25,125,,,,,这种多个5组成,考虑这个就ok啦。燃鹅人老了,忘了把计数器定义成longlong类型。c++版本:classSolution{public:/**@paramn:Alonginteger*@return:Aninteger,denotethenumbero
Charles_k
·
2017-11-29 21:46
lintcode
LintCode
367 [Expression Tree Build]
原题表达树是一个二叉树的结构,用于衡量特定的表达。所有表达树的叶子都有一个数字字符串值。而所有表达树的非叶子都有另一个操作字符串值。给定一个表达数组,请构造该表达的表达树,并返回该表达树的根。对于(2*6-(23+7)/(1+2))的表达(可表示为["2""*""6""-""(""23""+""7"")""/""(""1""+""2"")"]).其表达树如下:[-]/\[*][/]/\/\[2][
Jason_Yuan
·
2017-11-27 03:16
LintCode
之6 合并排序数组
题目来源:合并排序数组题目描述:合并两个排序的整数数组A和B变成一个新的数组。样例:给出A=[1,2,3,4],B=[2,4,5,6],返回[1,2,2,3,4,4,5,6]Java代码:publicint[]mergeSortedArray(int[]A,int[]B){//Writeyourcodehereint[]result=newint[A.length+B.length];intaco
Guoshi_Wan
·
2017-11-24 16:32
LintCode刷题
【
Lintcode
刷题】算法(持续更新)
阅读更多
Lintcode
刷题地址:http://www.
lintcode
.com/zh-cn/problem/#_=_一些大厂面试时喜欢考查的,对于锻炼自己的逻辑思维也大有裨益~发现对链表的考察较多。。
Everyday都不同
·
2017-11-22 16:00
算法
Lintcode
Snapchat SDE 电面+onsite面经
题目是2sum,3sum,4sum1.
LintCode
:2Sum
LintCode
原题链接:http:/
Rose_Li_97
·
2017-11-21 20:44
Lintcode
108 Palindrome Partitioning || solution 题解
【题目链接】www.
lintcode
.co
AdmondGuo
·
2017-11-19 01:07
算法
面试题
lintcode
上一页
59
60
61
62
63
64
65
66
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他