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
]实现简单的a+b(位运算篇)
实现简单的a+b说明a和b都是32位整数么?是的我可以使用位运算符么?当然可以样例如果a=1并且b=2,返回3。挑战显然你可以直接returna+b,但是你是否可以挑战一下不这样做?(不使用"+"等算数运算符)当然,我们的目标就是这个挑战.如果是有基础的小伙伴,一定会瞬间想到,我们可以使用位运算啊,对,我们就要是用位运算来解决这个问题.我将会通过三个例子来分析如何推算出计算过程的.//我们如何知道
PowerDon
·
2018-09-27 18:36
Lintcode
175. 翻转二叉树
我的代码:classSolution:"""@paramroot:aTreeNode,therootofthebinarytree@return:nothing"""definvertBinaryTree(self,root):ifroot.left==Noneandroot.right==None:returnifroot.left!=Noneandroot.right==None://这里一定
Sallywa
·
2018-09-23 21:22
LintCode
-二叉树的路径和 I、II
I描述给定一个二叉树,找出所有路径中各节点相加总和等于给定目标值的路径。一个有效的路径,指的是从根节点到叶节点的路径。样例给定一个二叉树,和目标值=5:1/\24/23返回:[[1,2,2],[1,4]]代码"""DefinitionofTreeNode:classTreeNode:def__init__(self,val):self.val=valself.left,self.right=Non
想当厨子的程序员
·
2018-09-22 10:10
【两次过】
Lintcode
1006. 子域名访问计数
诸如discuss.
lintcode
.com这样的域名由各种子域名构成。
小马哥MAX
·
2018-09-17 10:48
lintcode
背包问题总结
前面是转载来的背包9讲,非常详细,后面有几个
lintcode
上的题目前言本篇文章是我(dd_engi)正在进行中的一个雄心勃勃的写作计划的一部分,这个计划的内容是写作一份较为完善的NOIP难度的动态规划总结
默一鸣
·
2018-09-12 02:25
Interview
Data
Structures
&
Algrithm
程序员常用的刷题网站
1、
Lintcode
Lintcode
.com——
LintCode
网站是国内较大的在线编程&测评网站。
淡淡的宁静
·
2018-09-11 10:18
[
lintcode
] 简单
2.尾部的零描述设计一个算法,计算出n阶乘中尾部零的个数您在真实的面试中是否遇到过这个题?是样例11!=39916800,因此应该返回2挑战O(logN)的时间复杂度classSolution{public:/**@paramn:Alonginteger*@return:Aninteger,denotethenumberoftrailingzerosinn!*/longlongtrailingZe
热心市民Daisy
·
2018-08-22 19:05
数据结构与算法练习
[
lintcode
] 简单
2.尾部的零描述设计一个算法,计算出n阶乘中尾部零的个数您在真实的面试中是否遇到过这个题?是样例11!=39916800,因此应该返回2挑战O(logN)的时间复杂度classSolution{public:/**@paramn:Alonginteger*@return:Aninteger,denotethenumberoftrailingzerosinn!*/longlongtrailingZe
热心市民Daisy
·
2018-08-22 19:05
数据结构与算法练习
[
lintcode
]入门
37.反转一个3位整数描述反转一个只有3位数的整数。你可以假设输入一定是一个只有三位数的整数,这个整数大于等于100,小于1000。您在真实的面试中是否遇到过这个题?是样例123反转之后是321。900反转之后是9。classSolution{public:/***@paramnumber:A3-digitnumber.*@return:Reversednumber.*/intreverseInt
热心市民Daisy
·
2018-08-22 17:18
数据结构与算法练习
LeetCode
LintCode
干货全集 2018
JavaAlgorithmProblems序言从开始这个Github已经有将近三四年时间,很高兴可以帮到有需要的人.我一直认为,知识本身是无价的,因此每逢闲暇,我就会来维护,给刷题的朋友们一些我的想法和见解.希望大家学习顺利,对未来充满希望.有问题可以给我写邮件(
[email protected]
),或者在GitHub上发issue给我.转眼已经2018年,我过去写过的两版文章已经算是过期,因为
张土汪
·
2018-08-20 12:29
LeetCode
LintCode
干货全集 2018
JavaAlgorithmProblems序言从开始这个Github已经有将近三四年时间,很高兴可以帮到有需要的人.我一直认为,知识本身是无价的,因此每逢闲暇,我就会来维护,给刷题的朋友们一些我的想法和见解.希望大家学习顺利,对未来充满希望.有问题可以给我写邮件(
[email protected]
),或者在GitHub上发issue给我.转眼已经2018年,我过去写过的两版文章已经算是过期,因为
张土汪
·
2018-08-20 12:29
LintCode
-First Position of Target
FirstPositionofTargetDescriptionForagivensortedarray(ascendingorder)andatargetnumber,findthefirstindexofthisnumberinO(logn)timecomplexity.Ifthetargetnumberdoesnotexistinthearray,return-1.ExampleIfthea
Immortal_s
·
2018-08-18 20:15
LintCode
LintCode
-Implement strStr()
ImplementstrStr()DescriptionForagivensourcestringandatargetstring,youshouldoutputthefirstindex(from0)oftargetstringinsourcestring.Iftargetdoesnotexistinsource,justreturn-1.ClarificationDoIneedtoimplem
Immortal_s
·
2018-08-17 21:58
LintCode
lintcode
6. Merge Two Sorted Arrays(多回顾二分法)
image.png解法:很普通的三步走法,要主要加极端条件的判断;时间会大大缩短!!!不加判断,只能打败4.4%;加了之后91%classSolution{public:/***@paramA:sortedintegerarrayA*@paramB:sortedintegerarrayB*@return:Anewsortedintegerarray*/vectormergeSortedArray(
刘小小gogo
·
2018-07-25 23:37
[
LintCode
/LeetCode] Contains Duplicate II
ProblemGivenanarrayofintegersandanintegerk,findoutwhethertherearetwodistinctindicesiandjinthearraysuchthatnums[i]=nums[j]andtheabsolutedifferencebetweeniandjisatmostk.ExampleGivennums=[1,2,1],k=0,retu
linspiration
·
2018-07-23 00:00
LintCode
java
hashset
复习索引
1.理论知识1.1机器学习1.2深度学习1.3数学知识1.4开发(CS基础)2.代码能力2.1数据结构与算法(剑指offer,
LintCode
,LeetCode)2.2语言(C++,Python,
步晓德
·
2018-07-22 22:04
[LeetCode/
LintCode
] Sentence Similarity
ProblemGiventwosentenceswords1,words2(eachrepresentedasanarrayofstrings),andalistofsimilarwordpairspairs,determineiftwosentencesaresimilar.Forexample,"greatactingskills"and"finedramatalent"aresimilar,
linspiration
·
2018-07-18 00:00
List
数组
java
LintCode
[
LintCode
/LeetCode] Set Mismatch
ProblemThesetSoriginallycontainsnumbersfrom1ton.Butunfortunately,duetothedataerror,oneofthenumbersinthesetgotduplicatedtoanothernumberintheset,whichresultsinrepetitionofonenumberandlossofanothernumber
linspiration
·
2018-07-18 00:00
数组
LintCode
java
hashset
[
LintCode
/LeetCode] Integer Replacement
ProblemGivenapositiveintegernandyoucandooperationsasfollow:1.Ifniseven,replacenwithn/2.2.Ifnisodd,youcanreplacenwitheithern+1orn-1.Whatistheminimumnumberofreplacementsneededforntobecome1?ExampleExampl
linspiration
·
2018-07-16 00:00
LintCode
leetcode
mathematics
java
[
LintCode
/LeetCode] Count Univalue Subtrees
ProblemGivenabinarytree,countthenumberofuni-valuesubtrees.AUni-valuesubtreemeansallnodesofthesubtreehavethesamevalue.ExampleGivenroot={5,1,5,5,5,#,5},return4.5/\15/\\555SolutionpublicclassSolution{/**
linspiration
·
2018-07-16 00:00
recursion
binary-tree
java
LintCode
[
LintCode
] Set Union
ProblemThereisalistcomposedbysets.Iftwosetshavethesameelements,mergethem.Intheend,thereareseveralsetsleft.ExampleGivenlist=[[1,2,3],[3,9,7],[4,5,10]],return2.Explanation:Thereare2setsof[1,2,3,9,7]and[
linspiration
·
2018-07-16 00:00
java
graph
union-find
[转]在线编程刷题网站
http://
lintcode
.com/zh-cn/编程面试题在线训练平台。http://codeforces.com/为计算机编程爱好者提供在线评测系
实力的历史
·
2018-07-09 23:58
java技术
[
LintCode
] The Number In Words
ProblemGivenanon-negativeintegern,printthenumberinwords.ExampleGivenn=125ReturnonehundredtwentyfiveSolutionclassSolution{privateString[]belowTen=newString[]{"","One","Two","Three","Four","Five","Six",
linspiration
·
2018-07-08 00:00
math
LintCode
java
LintCode
:跳跃游戏
描述给出一个非负整数数组,你最初定位在数组的第一个位置。数组中的每个元素代表你在那个位置可以跳跃的最大长度。判断你是否能到达数组的最后一个位置。样例A=[2,3,1,1,4],返回true.A=[3,2,1,0,4],返回false.动态规划实现:publicclassSolution{publicbooleancanJump(int[]A){if(A==null||A.length<2)retu
karute
·
2018-07-07 15:58
LintCode
:跳跃游戏 I VS跳跃游戏 II
描述给出一个非负整数数组,你最初定位在数组的第一个位置。数组中的每个元素代表你在那个位置可以跳跃的最大长度。判断你是否能到达数组的最后一个位置。分析:方法一:基于动态规划的做法,时间复杂度O(n^2)。数组dp[i]表示能否到达下标为i的位置,对于从下标i=1开始的每一个位置,都从下标j=0开始到i-1判断能否到达j,并且判断从j开始最远能否跳到或超过i的位置,如果能,则令dp[i]=true,并
HxxxxxxxU
·
2018-07-07 14:08
LintCode
LintCode
:跳跃游戏 II
描述给出一个非负整数数组,你最初定位在数组的第一个位置。数组中的每个元素代表你在那个位置可以跳跃的最大长度。你的目标是使用最少的跳跃次数到达数组的最后一个位置。样例给出数组A=[2,3,1,1,4],最少到达数组最后一个位置的跳跃次数是2(从数组下标0跳一步到数组下标1,然后跳3步到数组的最后一个位置,一共跳跃2次)动态规划实现:publicclassSolution{publicintjump(
karute
·
2018-07-07 13:25
LintCode
:哈希函数 · hash function
今天在
LintCode
上做了一道关于哈希函数的题目,感受到了数学思维在编程中的重要性,不多说,上题:题目在数据结构中,哈希函数是用来将一个字符串(或任何其他类型)转化为小于哈希表大小且大于等于零的整数。
HelloLeif
·
2018-06-29 17:49
LintCode
算法
Remove K Digits
https://www.
lintcode
.com/problem/remove-k-digits/descriptionpublicclassSolution{/***@paramnum:astring
天街孤独
·
2018-06-28 11:48
[
LintCode
/LeetCode] Binary Tree Pruning
ProblemBinaryTreePruningWearegiventheheadnoderootofabinarytree,whereadditionallyeverynode'svalueiseithera0ora1.Returnthesametreewhereeverysubtree(ofthegiventree)notcontaininga1hasbeenremoved.(Recallth
linspiration
·
2018-06-27 00:00
binary-tree
recursion
java
LintCode
leetcode
[
LintCode
] Teemo Attacking
ProblemInLOLworld,thereisaherocalledTeemoandhisattackingcanmakehisenemyAshebeinpoisonedcondition.Now,giventheTeemo'sattackingascendingtimeseriestowardsAsheandthepoisoningtimedurationperTeemo'sattackin
linspiration
·
2018-06-27 00:00
java
LintCode
[LeetCode/
LintCode
] 24 Game
ProblemYouhave4cardseachcontaininganumberfrom1to9.Youneedtocomputewhethertheycouldoperatedthrough*,/,+,-,(,)togetthevalueof24.ExampleGivennums=[4,1,8,7],returntrue//8(7-4)1=24Givennums=[1,1,1,2],retur
linspiration
·
2018-06-25 00:00
leetcode
LintCode
dfs
[
LintCode
] Order Problem
ProblemThereisnowanorderwithdemandfornitems,andthedemandforthei-thitemisorder[i].Thefactoryhasmproductionmodes.Eachproductionmodeisshapedlike[p[1],p[2],...p[n]],thatis,producep[1]firstitems,p[2]second
linspiration
·
2018-06-24 00:00
dfs
java
alibaba
Longest Substring with At Least K Repeating Characters
https://www.
lintcode
.com/problem/longest-substring-with-at-least-k-repeating-characters/descriptionpublicclassSolution
天街孤独
·
2018-06-22 14:15
Non-overlapping Intervals
https://www.
lintcode
.com/problem/non-overlapping-intervals/descriptionimportjava.util.Collections;importjava.util.Comparator
天街孤独
·
2018-06-19 16:28
[
LintCode
] Twitch Words
ProblemOurnormalwordsdonothavemorethantwoconsecutiveletters.Iftherearethreeormoreconsecutiveletters,thisisatics.Nowgiveaword,fromlefttoright,tofindoutthestartingpointandendingpointofalltics.ExampleGiv
linspiration
·
2018-06-12 00:00
数组
arraylist
LintCode
java
211. 字符串置换
提示
LintCode
中的相关算法题实现代码,可以在我的GitHub中下载。题目需求给定两个字符串,请设计一个方法来判定其中一个字符串是否为另一个字符串的置换。
Oeljeklaus
·
2018-06-11 15:45
LintCode
LintCode刷题指南
[
LintCode
] K-diff Pairs in an Array
ProblemGivenanarrayofintegersandanintegerk,youneedtofindthenumberofuniquek-diffpairsinthearray.Hereak-diffpairisdefinedasanintegerpair(i,j),whereiandjarebothnumbersinthearrayandtheirabsolutedifference
linspiration
·
2018-06-11 00:00
LintCode
java
数组
[
LintCode
] Permutation in String
ProblemGiventwostringss1ands2,writeafunctiontoreturntrueifs2containsthepermutationofs1.Inotherwords,oneofthefirststring'spermutationsisthesubstringofthesecondstring.ExampleExample1:Input:s1="ab"s2="ei
linspiration
·
2018-06-11 00:00
LintCode
java
permutations
【
lintcode
】1011. 二叉查找树中搜索区间
描述给定两个值k1和k2(k1searchRange(TreeNoderoot,intk1,intk2){//writeyourcodehereTreeSettreeSet=newTreeSet();Listlist=newArrayList();QueueQ=newArrayBlockingQueue(1000);if(root!=null){Q.add(root);treeSet.add(Q.
JEYMING
·
2018-06-09 14:31
lintcode解题思考
LintCode
—两数组的交(547)
算法—排序:(两数组的交)一、题目:求出两个数组的交集样例:nums1=[1,2,2,1],nums2=[2,2],返回[2].二、分析:需要考虑的点:1.数组初始化后位数固定,需要先进行数据类型转换;三、代码:publicclassSolution{/**@paramnums1:anintegerarray*@paramnums2:anintegerarray*@return:aninteger
Ge_zi327
·
2018-06-07 22:39
Java
LintCode
Minimum Moves to Equal Array Elements
https://www.
lintcode
.com/problem/minimum-moves-to-equal-array-elements/descriptionpublicclassSolution
天街孤独
·
2018-06-05 13:06
56. 两数之和
提示
LintCode
中的相关算法题实现代码,可以在我的GitHub中下载。题目需求描述给一个整数数组,找到两个数使得他们的和等于一个给定的数target。
Oeljeklaus
·
2018-06-05 08:44
LintCode
LintCode刷题指南
[
LintCode
] 3Sum Smaller
ProblemGivenanarrayofnintegersnumsandatarget,findthenumberofindextripletsi,j,kwith0=target)return0;intcount=0;for(inti=0;i
linspiration
·
2018-06-05 00:00
数组
java
LintCode
Lintcode
547 Intersection of Two Arrays 题解
【题目描述】Giventwoarrays,writeafunctiontocomputetheirintersection.ExampleGivennums1=[1,2,2,1],nums2=[2,2],return[2].NoticeEachelementintheresultmustbeunique.Theresultcanbeinanyorder.给定两个数组,编写函数计算它们的交集。举例:
plai_d75a
·
2018-06-04 17:18
6. 合并排序数组 II
提示
LintCode
中的相关算法题实现代码,可以在我的GitHub中下载。题目要求合并两个排序的整数数组A和B变成一个新的数组。
Oeljeklaus
·
2018-06-02 21:36
LintCode
合并排序的数组II
LintCode
LintCode刷题指南
给定一个数字列表,返回其所有可能的排列
lintcode
描述:给出一个列表[1,2,3],其全排列为:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]c++实现代码如下classSolution{public:/**@paramnums:Alistofintegers.*@return:Alistofpermutations.*/vector>permute(vector&nums){vector>ba
生活要有意义
·
2018-05-30 18:46
lintcode
392-打劫房屋
题目描述:唯一约束是不能连续拿两个房间的钱,只能是隔一个或者更多。此题可以利用动态规划的想法,利用一个数组arr,arr[i]表示i房间及其以前的可以拿到的最多金钱。此时针对第i个房间,就有两种情况:1)拿第i个房间的钱,那么就不能拿i-1房间,拿到的钱就是arr[i-2]+A[i]2)不拿第i个房间的钱,那么可以拿到的最多金钱就是arr[i-1]取两者较大值,就是arr[i]的值。即arr[i]
ddou_pan
·
2018-05-30 13:16
lintcode
Lintcode
539 Move Zeroes solution 题解
【题目描述】Givenanarraynums,writeafunctiontomoveall0'stotheendofitwhilemaintainingtherelativeorderofthenon-zeroelements.NoticeYoumustdothisin-placewithoutmakingacopyofthearray.Minimizethetotalnumberofopera
程风破浪会有时
·
2018-05-29 08:19
[
LintCode
/LeetCode] Remove Duplicate Letters
ProblemGivenastringwhichcontainsonlylowercaseletters,removeduplicateletterssothateveryletterappearonceandonlyonce.Youmustmakesureyourresultisthesmallestinlexicographicalorderamongallpossibleresults.Ex
linspiration
·
2018-05-29 00:00
stack
java
leetcode
LintCode
Lintcode
535 House Robber III solution 题解
【题目描述】Thethiefhasfoundhimselfanewplaceforhisthieveryagain.Thereisonlyoneentrancetothisarea,calledthe"root."Besidestheroot,eachhousehasoneandonlyoneparenthouse.Afteratour,thesmartthiefrealizedthat"allh
程风破浪会有时
·
2018-05-28 22:05
上一页
56
57
58
59
60
61
62
63
下一页
按字母分类:
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
其他