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
Excel Sheet Column Number
https://www.
lintcode
.com/problem/excel-sheet-column-number/descriptionpublicclassSolution{/***@params
天街孤独
·
2020-02-28 02:56
LintCode
单词搜索
题目给出一个二维的字母板和一个单词,寻找字母板网格中是否存在这个单词。单词可以由按顺序的相邻单元的字母组成,其中相邻单元指的是水平或者垂直方向相邻。每个单元中的字母最多只能使用一次。样例给出board=["ABCE","SFCS","ADEE"]word="ABCCED",->返回true,word="SEE",->返回true,word="ABCB",->返回false.分析深度搜索方法代码pu
六尺帐篷
·
2020-02-28 02:02
lintcode
搜索区间
如果目标值不在数组中,则返回[-1,-1]样例给出[5,7,7,8,8,10]和目标值target=8,返回[3,4]题目链接:http://www.
lintcode
.com/zh-cn/problem
yzawyx0220
·
2020-02-27 23:51
LintCode
57-三数之和
分析注意hash去重classSolution{public:/***@paramnumbers:Giveanarraynumbersofninteger*@return:Findalluniquetripletsinthearraywhichgivesthesumofzero.*/vector>threeSum(vector&nums){//writeyourcodeherevector>ret
胡哈哈哈
·
2020-02-27 20:06
Lintcode
406 Minimum Size Subarray Sum solution 题解
【题目描述】Givenanarrayofnpositiveintegersandapositiveintegers,findtheminimallengthofasubarrayofwhichthesum≥s.Ifthereisn'tone,return-1instead.给定一个由n个正整数组成的数组和一个正整数s,请找出该数组中满足其和≥s的最小长度子数组。如果无解,则返回-1。【题目链接】w
程风破浪会有时
·
2020-02-27 18:17
LintCode
139 [Subarray Sum Closest]
原题给定一个整数数组,找到一个和最接近于零的子数组。返回第一个和最有一个指数。你的代码应该返回满足要求的子数组的起始位置和结束位置。给出[-3,1,1,-3,5],返回[0,2],[1,3],[1,1],[2,2]或者[0,4]O(nlogn)的时间复杂度解题思路首先建立一个pair类,便于记录前n项和与对应的index。因为后面要对sum数组排序,结果又要返回indexloop一遍有序的sum数
Jason_Yuan
·
2020-02-27 01:02
Lintcode
74 First Bad Version solution 题解
【题目描述】Thecodebaseversionisanintegerstartfrom1ton.Oneday,someonecommittedabadversioninthecodecase,soitcausedthisversionandthefollowingversionsareallfailedintheunittests.Findthefirstbadversion.Youcancal
程风破浪会有时
·
2020-02-27 00:13
LintCode
221 [Add Two Numbers II]
原题假定用一个链表表示两个数,其中每个节点仅包含一个数字。假设这两个数的数字顺序排列,请设计一种方法将两个数相加,并将其结果表现为链表的形式。样例给出6->1->7+2->9->5。即,617+295。返回9->1->2。即,912。解题思路整体思路与AddTwoNumbers一样,只不过链表和其表示的数值吮吸相同借助helper函数,反转链表完整代码#Definitionforsingly-li
Jason_Yuan
·
2020-02-26 22:02
LintCode
473. Add and Search Word
原题
LintCode
473.AddandSearchWordDescriptionDesignadatastructurethatsupportsthefollowingtwooperations:addWord
Andiedie
·
2020-02-26 18:38
LintCode
链表划分
题目给定一个单链表和数值x,划分链表使得所有小于x的节点排在大于等于x的节点之前。你应该保留两部分内链表节点原有的相对顺序。样例给定链表1->4->3->2->5->2->null,并且x=3返回**1->2->2->4->3->5->null**代码/***DefinitionforListNode.*publicclassListNode{*intval;*ListNodenext;*List
六尺帐篷
·
2020-02-26 17:32
OJ
lintcode
删除排序链表中的重复元素
给定一个排序链表,删除所有重复的元素每个元素只留下一个。您在真实的面试中是否遇到过这个题?Yes样例给出1->1->2->null,返回1->2->null给出1->1->2->3->3->null,返回1->2->3->null/***DefinitionofListNode*classListNode{*public:*intval;*ListNode*next;*ListNode(intva
zhaozhengcoder
·
2020-02-26 16:37
OJ
lintcode
两数组的交
返回两个数组的交您在真实的面试中是否遇到过这个题?Yes样例nums1=[1,2,2,1],nums2=[2,2],返回[2].classSolution{public:/***@paramnums1anintegerarray*@paramnums2anintegerarray*@returnanintegerarray*/vectorintersection(vector&nums1,vect
zhaozhengcoder
·
2020-02-26 15:02
Lintcode
109 Triangle solution 题解
【题目描述】Givenatriangle,findtheminimumpathsumfromtoptobottom.Eachstepyoumaymovetoadjacentnumbersontherowbelow.给定一个数字三角形,找到从顶部到底部的最小路径和。每一步可以移动到下面一行的相邻数字上。【注】:如果你只用额外空间复杂度O(n)的条件下完成可以获得加分,其中n是数字三角形的总行数。【题
程风破浪会有时
·
2020-02-26 12:02
lintcode
-排序矩阵中的从小到大第k个数
在一个排序矩阵中找从小到大的第k个整数。排序矩阵的定义为:每一行递增,每一列也递增。样例给出k=4和一个排序矩阵:[[1,5,7],[3,7,8],[4,8,9],]返回5。挑战:使用O(klogn)的方法,n为矩阵的宽度和高度中的最大值。注意make_pair()使用括号classSolution{public:/***@parammatrix:amatrixofintegers*@paramk
鬼谷神奇
·
2020-02-26 10:04
Roman to Integer(罗马数字转整数)
http://www.
lintcode
.com/en/problem/roman-to-integer/?
天街孤独
·
2020-02-26 10:02
[
LintCode
] Number of Islands
ProblemGivenaboolean2Dmatrix,findthenumberofislands.Notice0isrepresentedasthesea,1isrepresentedastheisland.Iftwo1isadjacent,weconsidertheminthesameisland.Weonlyconsiderup/down/left/rightadjacent.Examp
楷书
·
2020-02-25 20:21
Interleaving String(交叉字符串)
http://www.
lintcode
.com/zh-cn/problem/interleaving-string/publicclassSolution{/**@params1:Astring*@params2
天街孤独
·
2020-02-25 19:54
二进制求和(
LintCode
)
二进制求和1题目复现1)描述给定两个二进制字符串,返回他们的和(用二进制表示)。2)样例a=11b=1返回1002简单实现(C++)classSolution{public:/***@paramaanumber*@parambanumber*@returntheresult*/stringaddBinary(string&a,string&b){stringresult="";intc=0,num
木华
·
2020-02-25 19:18
LintCode
最小差
题目给定两个整数数组(第一个是数组A,第二个是数组B),在数组A中取A[i],数组B中取B[j],A[i]和B[j]两者的差越小越好(|A[i]-B[j]|)。返回最小差。样例给定数组A=[3,4,6,7],B=[2,3,8,9],返回0。代码publicclassSolution{/***@paramA,B:Twointegerarrays.*@return:Theirsmallestdiffe
六尺帐篷
·
2020-02-25 16:41
LintCode
子集
题目给出一个具有重复数字的列表,找出列表所有不同的排列。样例给出列表[1,2,2],不同的排列有:Paste_Image.png代码classSolution{/***@paramnums:Alistofintegers.*@return:Alistofuniquepermutations.*/publicList>permuteUnique(int[]nums){ArrayList>res=ne
六尺帐篷
·
2020-02-25 14:05
Perfect Squares(完美平方)
http://www.
lintcode
.com/zh-cn/problem/perfect-squares/?
天街孤独
·
2020-02-25 14:48
LintCode
- 等价二叉树(普通)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:容易要求:检查两棵二叉树是否等价。等价的意思是说,首先两棵二叉树必须拥有相同的结构,并且每个对应位置上的节点上的数都相等。样例11/\/\22and22//44就是两棵等价的二叉树。11/\/\23and23/\44就不是等价的。思路:/***@parama,b,therootofbinarytrees.*@returntrueifthey
柒黍
·
2020-02-25 12:37
Lintcode
44 Minimum Subarray solution 题解
【题目描述】Givenanarrayofintegers,findthesubarraywithsmallestsum.Returnthesumofthesubarray.Notice:Thesubarrayshouldcontainoneintegeratleast.给定一个整数数组,找到一个具有最小和的子数组。返回其最小和。注意:子数组最少包含一个数字【题目链接】http://www.lint
代码码着玩
·
2020-02-25 09:25
Lintcode
413 Reverse Integer solution 题解
【题目链接】www.
lintcode
.com/en/problem/reverse-integer/【题目解析】1)先不考虑正负和溢出,将
程风破浪会有时
·
2020-02-25 06:53
lintcode
1-4
1.A+B问题给出两个整数a和b,求他们的和,但不能使用+等数学运算符。加减法在底层是使用二进制来进行运算的。加法,位运算按位求反~运来为1,变为0,0变为1;~1010=0101与运算&两个对应位置都为1,则为1,否则为0。1010&1011=·1010或运算|两个对应位置都为0,则为0,否则为1。1010|1011=1011异或运算^两个对应位置只有一个为1,则为1,否则为0。1010^101
Myth52125
·
2020-02-25 04:40
LintCode
简化路径
题目给定一个文档(Unix-style)的完全路径,请进行路径简化。样例"/home/",=>"/home""/a/./b/../../c/",=>"/c"分析思路比较简单,遇到..就回到上一级,遇到.或者空就不处理。我们使用一个队列来处理,同时将三个需要特殊处理的字符存到一个set里面代码publicclassSolution{/***@parampaththeoriginalpath*@ret
六尺帐篷
·
2020-02-25 00:12
LintCode
10 [String Permutation II]
原题给出一个字符串,找到它的所有排列,注意同一个字符串不要打印两次。样例给出"abb",返回["abb","bab","bba"]。给出"aabb",返回["aabb","abab","baba","bbaa","abba","baab"]。解题思路思路跟PermutationII完全一样完整代码classSolution:#@param{string}strastring#@return{str
Jason_Yuan
·
2020-02-25 00:13
LintCode
- 删除排序链表中的重复元素(普通)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:容易要求:给定一个排序链表,删除所有重复的元素每个元素只留下一个。样例给出1->1->2->null,返回1->2->null给出1->1->2->3->3->null,返回1->2->3->null思路:/***@paramListNodeheadistheheadofthelinkedlist*@return:ListNodeheado
柒黍
·
2020-02-24 23:17
LintCode
104. 合并k个排序链表
原题解第一步,万年不变的查错。如果给的list是null或空,直接returnpublicListNodemergeKLists(Listlists){if(lists==null||lists.size()==0){returnnull;}...}最简单的方法当然还是PriorityQueue了,先建一个能比较node的PriorityQueue。Queuepq=newPriorityQueue
Jay_8d33
·
2020-02-24 19:38
Backpack VI(背包问题 VI)
http://www.
lintcode
.com/zh-cn/problem/backpack-vi/?
天街孤独
·
2020-02-24 19:31
lintcode
32 翻转链表
image.png思路image.png每次遍历的节点拿到最前面,作为新的head节点。head=p.next那么2节点的next地址不能丢了。p.next=head.next然后考虑2的后面是谁?head.next=q如果没有这个q,head.next=p。第三个节点出现的时候,就会把中间的丢了。因为每次新出来的节点要连接上次出来的点。需要有个引用指向它。p指向顺序遍历的尾节点。head是每次出
jose_dl
·
2020-02-24 15:28
LintCode
Binary Tree Maximum Node二叉树的最大节点
Findthemaximumnodeinabinarytree,returnthenode.样例给出如下一棵二叉树:1/-52/\/03-4-5返回值为3的节点。分析简单的递归思路,不过注意为空的情况,所以最好将为空的点的值设为最小值代码publicclassSolution{/***@paramroottherootofbinarytree*@returnthemaxndoe*/publicTr
六尺帐篷
·
2020-02-24 12:17
LintCode
7. Binary Tree Serialization
原题
LintCode
7.BinaryTreeSerializationDescriptionDesignanalgorithmandwritecodetoserializeanddeserializeabinarytree.Writingthetreetoafileiscalled'serialization'andreadingbackfromthefiletoreconstructtheexa
Andiedie
·
2020-02-24 09:02
Lintcode
94 Binary Tree Maximum Path Sum solution 题解
【题目链接】www.
lintcode
.com/en/problem/binary-tree-maximum
程风破浪会有时
·
2020-02-24 04:14
LintCode
将二叉树拆成链表
题目将一棵二叉树按照前序遍历拆解成为一个假链表。所谓的假链表是说,用二叉树的right指针,来表示链表中的next指针。**注意事项**不要忘记将左儿子标记为null,否则你可能会得到空间溢出或是时间溢出。样例微信截图_20161125162727.png分析显然这个问题可以用递归处理变成假链表的过程,就是将root的right指向左子树,左子树的尾节点指向右子树,最后再将左子树置空。返回尾节点即
六尺帐篷
·
2020-02-24 04:59
Integer to Roman(整数转罗马数字)
http://www.
lintcode
.com/en/problem/integer-to-roman/publicclassSolution{/**@paramn:Theinteger*@return
天街孤独
·
2020-02-24 03:52
LintCode
92. Backpack
原题
LintCode
92.BackpackDescriptionGivennitemswithsizeAi,anintegermdenotesthesizeofabackpack.Howfullyoucanfillthisbackpack
Andiedie
·
2020-02-23 21:00
Lintcode
75 Find Peak Element solution 题解
【题目描述】Thereisanintegerarraywhichhasthefollowingfeatures:·Thenumbersinadjacentpositionsaredifferent.·A[0]A[A.length-1].WedefineapositionPisapeekif:A[P]>A[P-1]&&A[p]>A[P+1]Findapeakelementinthisarray.Re
程风破浪会有时
·
2020-02-23 21:30
Lintcode
179 Update Bits solution 题解
【题目描述】Giventwo32-bitnumbers,NandM,andtwobitpositions,iandj.WriteamethodtosetallbitsbetweeniandjinNequaltoM(eg,MbecomesasubstringofNlocatedatiandstartingatj)Notice:Inthefunction,thenumbersNandMwillgive
程风破浪会有时
·
2020-02-23 19:07
366. Fibonacci
[http://www.
lintcode
.com/en/problem/fibonacci/]#PythonclassSolution:"""@param:n:aninteger@return:aninegerf
fdgump
·
2020-02-23 16:25
01 Matrix
https://www.
lintcode
.com/problem/01-matrix/descriptionimportjava.util.Arrays;publicclassSolution{/***
天街孤独
·
2020-02-23 16:54
OJ
lintcode
两数组的交 II
计算两个数组的交注意事项每个元素出现次数得和在数组里一样答案可以以任意顺序给出您在真实的面试中是否遇到过这个题?Yes样例nums1=[1,2,2,1],nums2=[2,2],返回[2,2].classSolution{public:/***@paramnums1anintegerarray*@paramnums2anintegerarray*@returnanintegerarray*/vec
zhaozhengcoder
·
2020-02-23 16:10
largest devisible subset
http://
lintcode
.com/en/problem/largest-divisible-subset/https://leetcode.com/problems/largest-divisible-subset
Zihowe
·
2020-02-23 14:45
LintCode
57. 3Sum
原题
LintCode
57.3SumDescriptionGivenanarraySofnintegers,arethereelementsa,b,cinSsuchthata+b+c=0?
Andiedie
·
2020-02-23 14:26
最大数 (
lintcode
:largest-number)
给出一组非负整数,重新排列他们的顺序把他们组成一个最大的整数。最后的结果可能很大,所以我们返回一个字符串来代替这个整数。样例:给出[1,20,23,4,8],返回组合最大的整数应为8423201。思路:把两个数拼在一起,然后再把这两个数换个顺序再拼在一起,这时候就可以直接比较了。比如2332和23,变成233223和232332两个数,这时候哪个数更大,就说明这个数前半部分的那个数是更大的,这里是
v1coder
·
2020-02-23 11:15
LintCode
领扣 题解 | Hulu 面试题:Print Organization Chart
题目描述按员工姓名,上一级姓名,职位,年份给出一系列企业中员工的关系,输出企业成员组织结构图。思路点拨按员工关系表建立一棵树,然后先序遍历这棵树,注意树的每一层要进行排序。考点分析本题主要考察了树的构造与树的遍历,首先根据每位员工上一级的信息构造出树结构,再对这颗树进行先序遍历,即可以得到答案,值得注意的是每一级员工要按名字的字典序进行排序。参考程序https://www.jiuzhang.com
领扣喵
·
2020-02-23 10:53
LintCode
14 [First Position of Target]
原题给定一个排序的整数数组(升序)和一个要查找的整数target,用O(logn)的时间查找到target第一次出现的下标(从0开始),如果target不存在于数组中,返回-1。在数组[1,2,3,3,4,5,10]中二分查找3,返回2。解题思路首先使用start+1表示相交或者相邻停止因为是找第一次出现的位置所以ifnums[mid]
Jason_Yuan
·
2020-02-23 09:48
丑数(
lintcode
)
因为丑数只含素因子2,3,5。所以任一丑数=2或3或5*更小的丑数(因为丑数素因子只由235组成,所以分解出了一个2或3或5,剩下部分仍是丑数)所以用235*其他丑数,可以求得所有丑数假如an是丑数数列,那丑数的全集就是2a12a2...2*an3a13a2...2*an5a15a2...2*an我们把1作为丑数的第一项a1不难看出这是一个从左到右从上到下递增的二维数组。我们可以把每行的第一个(2
剑戈2
·
2020-02-23 09:11
Lintcode
14 First Position of Target Solution 题解
【题目描述】Foragivensortedarray(ascendingorder)andatargetnumber,findthefirstindexofthisnumberinO(logn)timecomplexity.Ifthetargetnumberdoesnotexistinthearray,return-1.给定一个排序的整数数组(升序)和一个要查找的整数target,用O(logn)
代码码着玩
·
2020-02-23 07:51
Lintcode
366 Fibonacci solution 题解
【题目描述】FindtheNthnumberinFibonaccisequence.AFibonaccisequenceisdefinedasfollow:Thefirsttwonumbersare0and1.Theithnumberisthesumofi-1thnumberandi-2thnumber.ThefirsttennumbersinFibonaccisequenceis:0,1,1,2
程风破浪会有时
·
2020-02-23 07:00
上一页
44
45
46
47
48
49
50
51
下一页
按字母分类:
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
其他