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
python_
LintCode
(简单)
题35.翻转链表翻转一个链表样例:给出一个链表1->2->3->null,这个翻转后的链表为3->2->1->null"""DefinitionofListNodeclassListNode(object):def__init__(self,val,next=None):self.val=valself.next=next"""classSolution:"""@paramhead:n@retur
战战兢兢
·
2018-05-28 22:00
学习笔记
算法菜鸟
python算法基础—
LintCode
链表(入门)
写在前面不自量力面试某公司算法工程师,惨不忍说之后决定从头学习算法。希望自己能够坚持。链表(入门)一共两道题。题目来源很随意地从链表开始刷题。入门题466:计算链表中有多少个节点.样例:给出1->3->5,返回3."""DefinitionofListNodeclassListNode(object):def__init__(self,val,next=None):self.val=valself
战战兢兢
·
2018-05-27 16:11
学习笔记
算法菜鸟
Manacher’s Algorithm – Linear Time Longest Palindromic Substring
Manacher’sAlgorithm是一种高效查询最长回文串的算法,我在
lintcode
题目中用于统计输入的字符串拥有多少个回文子串。
萧沪椿Helson
·
2018-05-24 14:01
BaseResponse公共响应类
packagecom.simple.dto;/***公共响应类*@param*/publicclassBaseResponse{privatestaticfina
lintCODE
_SUCCESS=200
qq_36394738
·
2018-05-22 14:38
java
[LeetCode/
LintCode
] Course Schedule II
ProblemThereareatotalofncoursesyouhavetotake,labeledfrom0ton-1.Somecoursesmayhaveprerequisites,forexampletotakecourse0youhavetofirsttakecourse1,whichisexpressedasapair:[0,1]Giventhetotalnumberofcourse
linspiration
·
2018-05-21 00:00
bfs
graph
java
[
LintCode
] Buy Fruits
ProblemXiaoMingisgoingtohelpcompaniesbuyfruit.GiveacodeList,whichisloadedwiththefruithebought.GiveashoppingCart,whichisloadedwithtargetfruit.WeneedtocheckiftheorderinthecodeListmatchestheorderinthesho
linspiration
·
2018-05-21 00:00
LintCode
java
lintcode
_两数相加不使用+号--采用位运算实现加法
#includeusingnamespacestd;intadd(inta,intb){intsum=a;/*直到进位的结果为0*/while(b!=0){sum=a^b;/*不考虑进位的和*/b=(a&b)>x>>y;z=add(x,y);cout<<z<<endl;}
叫我天真
·
2018-05-18 20:30
lintcode
LeetCode-两数&三数之和系列问题
三数之和
LintCode
57三数之和解题思路:先对数组排序,然后开始遍历,对于数组中的每一个元素,用两指针往中间夹,直到找出所有的解。
OkidoGreen
·
2018-05-14 12:30
算法-LeetCode
LintCode
-- 合并排序数组 II
原题地址https://www.
lintcode
.com/problem/merge-two-sorted-arrays/难度级别容易解题思路这道题一看,怎么这么眼熟,这不就是归并吗?publi
Oktfolio
·
2018-05-13 20:58
LintCode
算法——进制转换
开始在
LintCode
上学习算法,先从简单的算法开始练——进制转换描述:Givenadecimalnumbernandanintegerk,Convertdecimalnumberntobase-k.提供一个十进制数
喜欢声音好听的小怪兽
·
2018-05-06 18:35
一文搞定String
数据结构与算法/leetcode/
lintcode
题解StringString相关的题常出现在面试题中,实际开发也经常用到,这里总结下C++,Java,Python中字符串常用的方法。
yanyuaihuahua
·
2018-05-03 00:00
数据结构与算法
Lintcode
532 Reverse Pairs solution 题解
【题目描述】ForanarrayA,ifiA[j],called(A[i],A[j])isareversepair.returntotalofreversepairsinA.在数组中的两个数字如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。给你一个数组,求出这个数组中逆序对的总数。概括:如果a[i]>a[j]且i
程风破浪会有时
·
2018-05-02 17:24
lintcode
249. 统计前面比自己小的数的个数
这道题应用到了BIT,binaryindexedtree
lintcode
首先建立BIT,关于BIT,这里介绍一个YouTube印度大神的视频,非常清晰易懂链接,建议翻墙查看image.png这里我大致讲一下
Anseis
·
2018-04-30 09:57
[LeetCode/
LintCode
] First Bad Version
ProblemThecodebaseversionisanintegerstartfrom1ton.Oneday,someonecommittedabadversioninthecodecase,soitcausedthisversionandthefollowingversionsareallfailedintheunittests.Findthefirstbadversion.Youcanca
linspiration
·
2018-04-30 00:00
binary-search
java
二分查找
LintCode
网址登陆反爬虫CSRF禁止访问
lintcode
是一个非常流行的在线编程网站,今天在用python爬虫登陆进行模拟时,发现以下问题:经过了解:CSRF全称:Cross-siterequestforgery,中文翻译为跨站请求伪造,也被称为
h249139571
·
2018-04-29 11:19
爬虫
Lintcode
524 Left Pad solution 题解
注意事项Youdon'tneedtoimplementtheremovemethod.www.
lintcode
.com/en/problem/left-pad/【题目解析】输入一个正整
程风破浪会有时
·
2018-04-25 08:58
LintCode
31. partitionArray 数组划分
31.partitionArray数组划分题目链接
lintcode
31partitionArray数组划分题目描述给出一个整数数组nums和一个整数k。
DeveloperChiu
·
2018-04-24 00:00
c++
LintCode
Lintcode
516 Paint House II solution 题解
【题目描述】Thecostofpaintingeachhousewithacertaincolorisrepresentedbyanxkcostmatrix.Forexample,costs[0][0]isthecostofpaintinghouse0withcolor0;costs[1][2]isthecostofpaintinghouse1withcolor2,andsoon...Findth
程风破浪会有时
·
2018-04-19 11:05
3Sum Smaller
http://www.
lintcode
.com/zh-cn/problem/3sum-smaller/publicclassSolution{/***@paramnums:anarrayofnintegers
天街孤独
·
2018-04-16 17:58
定义返回模板
publicenumResponseCode{SUCCESS(0,"SUCCESS"),ERROR(1,"ERROR"),privatefina
lintcode
;privatefinalStringdescibe
lllua
·
2018-04-15 15:55
干货
【
Lintcode
】合并排序数组&& 合并排序数组 II
题目描述:合并两个排序的整数数组A和B变成一个新的数组。注意事项你可以假设A具有足够的空间(A数组的大小大于或等于m+n)去添加B中的元素。样例:给出A=[1,2,3,empty,empty],B=[4,5]合并之后A将变成[1,2,3,4,5]思路:既然是合并有序的数组,那么我们肯定想到一个一个去比较,如果A的第一个数大于B的第一个数,就将A整体向后移动,然后将B的第一个数插入;如果A的第一个数
Monster_Girl
·
2018-04-13 16:43
Lintcode
Lintcode
56. 两数之和
给一个整数数组,找到两个数使得他们的和等于一个给定的数target。你需要实现的函数twoSum需要返回这两个数的下标,并且第一个下标小于第二个下标。注意这里下标的范围是0到n-1。注意事项你可以假设只有一组答案。样例给出numbers=[2,7,11,15],target=9,返回[0,1].挑战Eitherofthefollowingsolutionsareacceptable:O(n)Spa
CC丶Z
·
2018-04-12 20:52
刷题
动态规划常见题型--最小调整代价(Java)
较为经典的有背包问题的解决:https://blog.csdn.net/qq_34861102/article/details/79903634这里记录一下认为常见的题型使用二维数组:http://www.
lintcode
.com
zz_Outlier
·
2018-04-12 13:47
常见算法
python算法习题(五):单词拆分
样例:给一字串
lintcode
,字典为[“de”,“ding”,“co”,“code”,“lint”]则结果为[“
lintcode
”,“
lintcode
”]。
GiveMeFive_Y
·
2018-04-09 10:51
python
算法学习
用js实现编辑距离算法(Edit Distance)
题目
lintcode
题目链接给出两个单词word1和word2,计算出将word1转换为word2的最少操作次数。
mytac
·
2018-04-03 13:15
用js实现编辑距离算法(Edit Distance)
题目
lintcode
题目链接给出两个单词word1和word2,计算出将word1转换为word2的最少操作次数。
mytac
·
2018-04-03 13:06
算法
解锁
lintcode
-猫和狗的问题
1,采用cnn算法,目前准确率做到84.7%,用了几种图像预处理算法和旋转之类的增加训练样本的方法,效果不理想,后继续再改进,有高手欢迎分享源码一块学习2,遇到的一些问题及解决办法:(1)XXXisnan交叉熵计算时出现了梯度爆炸,需要对预测值做clip_by_value进行截断,注意一下min,与max的设置(2)对图像数据需要进行归一化可以选用tensorflow自带的tf.image.per
NBtingwu
·
2018-04-02 15:15
机器学习
lintcode
猫狗分类
人工智能
cnn
Lintcode
491 Palindrome Number solution 题解
【题目描述】Checkapositivenumberisapalindromeornot.Apalindromenumberisthatifyoureversethewholenumberyouwillgetexactlythesamenumber.NoticeIt'sguaranteedtheinputnumberisa32-bitinteger,butafterreversion,thenum
程风破浪会有时
·
2018-03-28 09:05
Climb Stairs - dynamic programming
Questionfrom
lintcode
Youareclimbingastaircase.Ittakesnstepstoreachthetop.Eachtimeyoucaneitherclimb1or2steps.Inhowmanydistinctwayscanyouclimbtothetop
Star_C
·
2018-03-26 21:54
lintcode
-交叉字符串
本题初想不算难,只能按照s1和s2字符串的顺序去挨个比较字符串s3,本能就会想到递归算法,利用递归去减少代码量,但是这里有一个隐藏点,当比较到的位置s1和s2字符相同,且都与s3的相同,此时就应该分两种情况,即让s1该字符与s3上进行比配,然后往后比较,或者让s2该字符与s3上进行匹配,然后往后比较。匹配过程中若存在s1和s2位置上字符都不能和s3上字符匹配,则匹配失败,s3不是s1和s2的交叉字
ddou_pan
·
2018-03-24 15:43
不用加号实现加法
题目说明这是一道在
lintcode
上的简单题:http://
lintcode
.com/en/problem/a-b-problem/说明如下:WriteafunctionthataddtwonumbersAandB.Youshouldnotuse
林逸凡_lyf
·
2018-03-22 16:54
好友请求
http://www.
lintcode
.com/zh-cn/problem/friend-request/publicclassSolution{/***@paramages:Theages*@return
天街孤独
·
2018-03-20 23:37
把排序数组转换为高度最小的二叉搜索树(
LintCode
177)
LintCode
中第177题,解答代码如下:privatestaticTreeNodesortedArrayToBST(int[]A){TreeNoderoot=recursion(A,0,A.length
dankun6599
·
2018-03-20 17:40
算法总结
(
LintCode
) No 5: Swap Two Integers in Array
题目描述:交换一个数列中两个数字的位置。代码如下:publicclassSolution{/***@paramA:Anintegerarray*@paramindex1:thefirstindex*@paramindex2:thesecondindex*@return:nothing*/publicvoidswapIntegers(int[]A,intindex1,intindex2){intn;
Amber_tq
·
2018-03-16 21:42
算法
(
LintCode
) No 4: Reverse 3-digit Integer
题目描述:将一个三位数逆序并输出这个数字,注意不是数列而是数字。代码如下:classSolution{public:/***@paramnumber:A3-digitnumber.*@return:Reversednumber.*/intreverseInteger(intnumber){inta[3];inti,n=0;for(i=0;i<3;i++){a[i]=number%10;number
Amber_tq
·
2018-03-16 21:19
算法
(
LintCode
) No 3: Sort Integers
题目描述:使用算法复杂度为O(n^2)的排序算法进行整数排序。启迪总结:c++中内置了很多功能,可以直接使用,前提是知道存在什么功能并且知道如何正确使用。代码如下:classSolution{public:/***@paramA:anintegerarray*@return:nothing*/voidsortIntegers(vector&A){//writeyourcodeheresort(A.
Amber_tq
·
2018-03-16 21:04
算法
(
LintCode
) No 2: Fabonacci
题目描述:输出对应的第几项数值。代码如下:classSolution{public:/***@paramn:aninteger*@return:aninegerf(n)*/intfibonacci(intn){//writeyourcodehereinta=0,b=1;for(inti=1;i<n;i++){intc=a+b;a=b;b=c;}returna;}};
Amber_tq
·
2018-03-16 19:11
算法
LintCode
464 整数排序 II
给一组整数,按照升序排序。使用归并排序,快速排序,堆排序或者任何其他O(nlogn)的排序算法。继续练习快速排序intf(vector&nums,intfirst,intend){inti=first,j=end;while(i&nums,intfirst,intend){if(first&A){//writeyourcodeheret(A,0,A.size()-1);}
dlnumk
·
2018-03-15 18:59
2018
LintCode
LintCode
11二叉查找树中搜索区间
给定两个值k1和k2(k1ans;voidf(TreeNode*root,intk1,intk2){if(root==NULL)return;if(root->val>=k1&&root->valval);}if(root->val>=k1){f(root->left,k1,k2);}if(root->valright,k1,k2);}return;}/***@paramroot:paramroo
dlnumk
·
2018-03-14 19:05
2018
LintCode
Java 算法 - 跳跃游戏(贪心法和动态规划)
贪心法在
lintCode
能够AC,leetCode不能AC。因为这道题是一道最优题,而贪心法不能保证最优题意:给出一个非负整数数组,你最初定位在数组的第一个位置。
琼珶和予
·
2018-03-13 23:06
Lintcode
6 Merge Two Sorted Arrays
MergetwogivensortedintegerarrayAandBintoanewsortedintegerarray.ExampleA=[1,2,3,4]B=[2,4,5,6]return[1,2,2,3,4,4,5,6]方法:直接造一个数组,从小到大把A和B数组里的数字往里放。如果A数组的数字都放完了,就把B数组的数字全部倒进去。如果B数组的数字都放完了,就把A数组的数字全部倒进去。cl
HowieLee59
·
2018-03-10 21:27
Leetcode
LintCode
76最长上升子序列
给定一个整数序列,找到最长上升子序列(LIS),返回LIS的长度。运用DP的思想一步步记录每一个数字的最长上升子序列一直到最后一个intlongestIncreasingSubsequence(vector&nums){//writeyourcodehereintans=0;intdp[1000];inti,j;dp[0]=1;for(i=1;inums[j]&&dp[j]>max){max=dp
dlnumk
·
2018-03-09 17:52
2018
LintCode
Python3
LintCode
代码 4.丑数 II
设计一个算法,找出只含素因子2,3,5的第n小的数。符合条件的数如:1,2,3,4,5,6,8,9,10,12...丑数的因子只含有2,3,5。我们默认将1作为第一个丑数。在此算法中,我们利用这一定义,2,3,5乘以2,3,5的倍数也一定是丑数,于是,将每轮取得的最小的丑数加入列表,直到取到我们所需要的丑数。classSolution:"""@paramn:Aninteger@return:the
Kevin_Pei
·
2018-03-08 20:30
LintCode代码
Lintcode
445 Cosine Similarity solution 题解
【题目描述】Cosinesimilarityisameasureofsimilaritybetweentwovectorsofaninnerproductspacethatmeasuresthecosineoftheanglebetweenthem.Thecosineof0°is1,anditislessthan1foranyotherangle.Seewiki:CosineSimilarityH
程风破浪会有时
·
2018-03-06 22:08
(
LintCode
) No 1: Hex Conversion
题目描述:如标题代码如下:没什么好说的classSolution{public:/***@paramn:adecimalnumber*@paramk:aIntegerrepresentbase-k*@return:abase-knumber*/stringhexConversion(intn,intk){//writeyourcodeherestringres="";if(n==0){return
Amber_tq
·
2018-03-04 17:57
算法
LintCode
-数字整除数
742.数字整除数一个数字整除数是指一个可以被其中包含的每个数字整除的数.举个例子,128是一个数字整除数,因为128%1==0,128%2==0,and128%8==0.并且,数字整除数不允许包含数字0.给出数字取值的上下限,输出一个包含所有数字整除数的列表,包括边界.注意事项0digitDivideNums(longlonglower,intupper){//writeyourcodehere
insidel
·
2018-03-02 19:11
c++
小练习:
lintcode
466. 链表节点计数
题目:计算链表中有多少个节点.样例:给出1->3->5,返回3.就很简单的练习"""DefinitionofListNodeclassListNode(object):def__init__(self,val,next=None):self.val=valself.next=next"""classSolution:"""@param:head:thefirstnodeoflinkedlist.@
Cold__Winter
·
2018-03-01 23:33
lintcode
日常练习:
lintcode
37. 反转一个3位整数
题目:反转一个只有3位数的整数。样例:123反转之后是321。900反转之后是9。评论指出有负数的情况,于是更改一下,代码:classSolution:"""@paramnumber:A3-digitnumber.@return:Reversednumber."""defreverseInteger(self,number):#writeyourcodehereif(number<0):a=num
Cold__Winter
·
2018-03-01 21:08
lintcode
LintCode
-岛屿的个数
433.岛屿的个数给一个01矩阵,求不同的岛屿的个数。0代表海,1代表岛,如果两个1相邻,那么这两个1属于同一个岛。我们只考虑上下左右为相邻。样例在矩阵:[[1,1,0,0,0],[0,1,0,0,1],[0,0,0,1,1],[0,0,0,0,0],[0,0,0,0,1]]中有3个岛.标签Zenefits谷歌脸书相关题目2中等大岛的数量21%2(breadth-first-search),(un
insidel
·
2018-02-28 17:17
lintcode
c++
LintCode
之56 两数之和
题目来源:两数之和题目描述:给一个整数数组,找到两个数使得他们的和等于一个给定的数target。你需要实现的函数twoSum需要返回这两个数的下标,并且第一个下标小于第二个下标。注意这里下标的范围是0到n-1。样例:给出numbers=[2,7,11,15],target=9,返回[0,1].Java代码:publicclassSolution{/**@paramnumbers:Anarrayof
Guoshi_Wan
·
2018-02-26 23:24
LintCode刷题
上一页
57
58
59
60
61
62
63
64
下一页
按字母分类:
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
其他