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
:删除元素
LintCode
:删除元素classSolution: """@paramA:Alistofintegers@paramelem:Aninteger@return:Thenewlengthafterremove
u012225151
·
2016-04-28 01:00
[
LintCode
] Super Ugly Number 超级丑陋数
Writeaprogramtofindthenthsuperuglynumber.Superuglynumbersarepositivenumberswhoseallprimefactorsareinthegivenprimelistprimesofsizek.Forexample,[1,2,4,7,8,13,14,16,19,26,28,32]isthesequenceofthefirst12
Grandyang
·
2016-04-27 13:00
[
LintCode
/LeetCode] Copy List with Random Pointer [链表复制与分离]
ProblemAlinkedlistisgivensuchthateachnodecontainsanadditionalrandompointerwhichcouldpointtoanynodeinthelistornull.ChallengeCouldyousolveitwithO(1)space?Note因为O(1)space,所以nohashtable。新建两个结点n1n2,令n1=hea
linspiration
·
2016-04-27 00:00
uber
linkedlist
java
LintCode
:字符大小写排序
LintCode
:字符大小写排序双指针。
u012225151
·
2016-04-26 23:00
LintCode
:数组划分
LintCode
:数组划分一前一后两根指针,当前面的指针大于k且后指针小于k时,交换两个指针的值,走到两根指针相遇。
u012225151
·
2016-04-26 23:00
LintCode
:平衡二叉树
LintCode
:平衡二叉树先对树的每个节点求高度,最后判断。"""
u012225151
·
2016-04-26 22:00
LintCode
: 合并排序数组
LintCode
:合并排序数组classSolution: #@paramAandB:sortedintegerarrayAandB.
u012225151
·
2016-04-26 21:00
LintCode
:最长无重复字符的子串
LintCode
:最长无重复字符的子串classSolution: #@params:astring #@return:aninteger deflengthOfLongestSubstring(self
u012225151
·
2016-04-26 20:00
LintCode
:最长回文子串
LintCode
:最长回文子串需要引入一个二维数组M[i]来记录字符串与反转后的字符串的重复状态,以字符串abcdzdcab为例,M[i]如下图所示:然后只需要找到M[i]上最长的连续1的个数就是最长回文字符串的长度
u012225151
·
2016-04-26 13:00
[
LintCode
] Left Pad 左填充
Youknowwhat,leftpadisjavascriptpackageandreferencedbyReact:GithublinkOnedayhisauthorunpublishedit,thenalotofjavascriptprojectsintheworldbroken.Youcanseefromgithubit'sonly11lines.Youjobistoimplementth
Grandyang
·
2016-04-26 13:00
[
LintCode
] Flatten Nested List Iterator 压平嵌套链表迭代器
Givenanestedlistofintegers,implementaniteratortoflattenit.Eachelementiseitheraninteger,oralist--whoseelementsmayalsobeintegersorotherlists.ExampleGiventhelist[[1,1],2,[1,1]],Bycallingnextrepeatedlyun
Grandyang
·
2016-04-26 12:00
[
LintCode
] Reverse Pairs 翻转对
ForanarrayA,ifiA[j],called(A[i],A[j])isareversepair.returntotalofreversepairsinA.ExampleGivenA=[2,4,1,3,5],(2,1),(4,1),(4,3)arereversepairs.return3 这道题跟LeetCode上的那道CountofSmallerNumbersAfterSelf是一样的,
Grandyang
·
2016-04-26 11:00
LintCode
:最长上升连续子序列
LintCode
:最长上升连续子序列classSolution: #@param{int[]}AanarrayofInteger #@return{int}aninteger deflongestIncreasingContinuousSubsequence
u012225151
·
2016-04-26 10:00
LintCode
:等价二叉树
LintCode
:等价二叉树如果一棵树前、中、后序遍历结果都一样的话肯定就是等价的了。"""
u012225151
·
2016-04-26 00:00
二叉树
遍历
LintCode
: Paint House II
LintCode
:PaintHouseII最简单的穷举法,可惜超时了,先留个坑~classSolution: #@param{int[][]}costsnxkcostmatrix #@return{int
u012225151
·
2016-04-25 23:00
LintCode
:Left Pad
LintCode
:LeftPad这里写链接内容classStringUtils: #@param{string}originalStrthestringwewanttoappendto #@param{
u012225151
·
2016-04-25 23:00
LintCode
:Paint House
LintCode
:PaintHouseclassSolution: #@param{int[][]}costsnx3costmatrix #@return{int}aninteger,theminimumcosttopaintallhouses
u012225151
·
2016-04-25 21:00
LintCode
:Ugly Number
LintCode
:UglyNumberclassSolution: #@param{int}numaninteger #@return{boolean}trueifnumisanuglynumberorfalse
u012225151
·
2016-04-25 20:00
LintCode
:装最多水的容器
LintCode
:装最多水的容器classSolution: #@paramheights:alistofintegers #@return:aninteger defmaxArea(self,heights
u012225151
·
2016-04-25 20:00
LintCode
: 带环链表 II
LintCode
:带环链表II"""DefinitionofListNodeclassListNode(object):def__init__(self,val,next=None):self.val=
u012225151
·
2016-04-25 13:00
链表
LintCode
: Fizz Buzz
Givennumbern.Printnumberfrom1ton.But:whennumberisdividedby3,print"fizz".whennumberisdividedby5,print"buzz".whennumberisdividedbyboth3and5,print"fizzbuzz".Thoseeasylevelquestions,itisimportanttomakecod
github_34333284
·
2016-04-25 09:00
LintCode
:翻转链表 II
LintCode
:翻转链表II这里写链接内容"""DefinitionofListNodeclassListNode(object):def__init__(self,val,next=None):self.val
u012225151
·
2016-04-24 23:00
链表
LintCode
:回文链表
LintCode
:回文链表#Definitionforsingly-linkedlist.
u012225151
·
2016-04-24 22:00
链表
LintCode
:格雷码
LintCode
:格雷码Thetrickypartofthisquestionistorecognizetherecursivestructurehere.Forn=0,sol=[0],that’sthebasecase.Forrecursivestep
u012225151
·
2016-04-24 22:00
LintCode
: 两个链表的交叉
LintCode
:两个链表的交叉最容易想到的当然是类似冒泡算法,代码:#Definitionforsingly-linkedlist.
u012225151
·
2016-04-24 21:00
算法
链表
LintCode
:把排序数组转换为高度最小的二叉搜索树
LintCode
:把排序数组转换为高度最小的二叉搜索树 classSolution: defsortedArrayToBST(self,A): begin=0 end=len(A)-1 root=self.sorted_tree
u012225151
·
2016-04-22 22:00
搜索
LintCode
:报数
LintCode
报数思路:求第n个数,刚需要对第n-1个数进行统计,按从高到低的顺序,将a个b改写为ab的形式即可。
u012225151
·
2016-04-22 16:00
LeetCode/
LintCode
ReviewPage 题解-总结
背景一年多以前我在知乎上答了有关LeetCode的问题,分享了一些自己做题目的经验。张土汪:刷leetcode是什么样的体验?慢慢有一些赞和感谢,备受鼓舞,于是我把所做过的题目用一个script跑了一下,编辑成一篇文章。这个总结页面是这么规划的:题目名称(答案链接)题目难度解题关键点学习过程中,我认为,成事四分靠刷题,六分靠总结.在漫长的刷题过程中,我们常常被海量的题目(据说今天已经有700题)压
张土汪
·
2016-04-22 12:48
LeetCode/
LintCode
ReviewPage 题解-总结
背景一年多以前我在知乎上答了有关LeetCode的问题,分享了一些自己做题目的经验。张土汪:刷leetcode是什么样的体验?慢慢有一些赞和感谢,备受鼓舞,于是我把所做过的题目用一个script跑了一下,编辑成一篇文章。这个总结页面是这么规划的:题目名称(答案链接)题目难度解题关键点学习过程中,我认为,成事四分靠刷题,六分靠总结.在漫长的刷题过程中,我们常常被海量的题目(据说今天已经有700题)压
张土汪
·
2016-04-22 12:48
[LeetCode/
LintCode
] Design Twitter/Mini Twitter
DesignTwitterNote建立两个HashMap,一个存user,一个存tweets。以及整型的时间戳timestamp。user的k-vpair是userId-follower_set,tweets的k-vpair是userId-tweets_linkedlist,tweets属于Tweet类,包含time和id两个参数。postTweet(userId,tweetId):首先,对于发推
linspiration
·
2016-04-22 00:00
twitter
java
ood
Lintcode
单词的添加与查找
单词的添加与查找 描述 笔记 数据 评测设计一个包含下面两个操作的数据结构:addWord(word), search(word)addWord(word)会在数据结构中添加一个单词。而search(word)则支持普通的单词查询或是只包含.和a-z的简易正则表达式的查询。一个 . 可以代表一个任何的字母。您在真实的面试中是否遇到过这个题? Yes 注意事项你可以假设所有的单词都只包含小写字母a
ouyangjinbin
·
2016-04-20 18:00
主元素、主元素II、主元素III
根据自己目前的能力写出来的算法还真没做到O(n)的时间复杂度,应该是O(n^2),不过居然通过了
lintcode
测试,而且是100%数据通过测试,费解ing。
surp2011
·
2016-04-20 17:00
算法
[
LintCode
/LeetCode] Unique Paths
ProblemArobotislocatedatthetop-leftcornerofamxngrid(marked'Start'inthediagrambelow).Therobotcanonlymoveeitherdownorrightatanypointintime.Therobotistryingtoreachthebottom-rightcornerofthegrid(marked'Fi
linspiration
·
2016-04-16 00:00
grid
java
[
LintCode
][Union Find] Number of Islands II
ProblemGivenan,mwhichmeanstherowandcolumnofthe2DmatrixandanarrayofpairA(sizek).Originally,the2Dmatrixisall0whichmeansthereisonlyseainthematrix.ThelistpairhaskoperatorandeachoperatorhastwointegerA[i].x
楷书
·
2016-04-15 11:51
位运算-加法运算、交换两个数值
引言这个问题的来源是http://www.
lintcode
.com/上的编号第一的面试题目,涉及到二进制位运算,很有意思。并且引出了之前关于二进制运算的好奇心,特此记录。
surp2011
·
2016-04-14 10:00
java
位运算
算法
二进制
字符串转换为整数
样例"10"=>10"-1"=>-1"123123123123123"=>2147483647"1.0"=>1分析该题目在
LintCode
上属于困难级别。主要是
逆風的薔薇
·
2016-04-13 17:43
C/C++
常见面试问题
字符串转换为整数
样例"10"=>10"-1"=>-1"123123123123123"=> 2147483647"1.0"=>1分析该题目在
LintCode
上属于困难级别。主
fly_yr
·
2016-04-13 17:00
[
LintCode
] Hash Function
ProblemIndatastructureHash,hashfunctionisusedtoconvertastring(oranyothertype)intoanintegersmallerthanhashsizeandbiggerorequaltozero.Theobjectiveofdesigningahashfunctionisto"hash"thekeyasunreasonableas
linspiration
·
2016-04-13 00:00
hash
java
[
LintCode
] Number of Airplanes in the Sky
ProblemGivenanintervallistwhichareflyingandlandingtimeoftheflight.Howmanyairplanesareontheskyatmost?NoticeIflandingandflyinghappensatthesametime,weconsiderlandingshouldhappenatfirst.ExampleForinterval
楷书
·
2016-04-11 00:15
APK打包安装过程
LintCode
每日一题https://github.com/Jensenczx/...序言写的越多发现的问题也就越多,不可否认,之前的博客现在看来有些东西自己理解的还是很有出入的,在后续过程中,也是需要自己进一步的去改进
Jensen
·
2016-04-11 00:00
android
从阶乘递归到subset题解的递归思想扩展
题目:
LintCode
/LeetCode给定一个含不同整数的集合,返回其所有的子集.如果S=[1,2,3],有如下的解: [ [3], [1], [2], [1,2,3], [1,3], [2,3],
qilei2010
·
2016-04-10 23:00
递归
[
LintCode
] Rehashing
ProblemThesizeofthehashtableisnotdeterminateattheverybeginning.Ifthetotalsizeofkeysistoolarge(e.g.size>=capacity/10),weshoulddoublethesizeofthehashtableandrehasheverykeys.Sayyouhaveahashtablelookslike
linspiration
·
2016-04-09 00:00
hashtable
hash
java
lintCode
(453)——将二叉树拆分成链表
题目描述:将一棵二叉树按照前序遍历拆解成为一个假链表。所谓的假链表是说,用二叉树的right指针,来表示链表中的next指针。注意事项:不要忘记将左儿子标记为null,否则你可能会得到空间溢出或是时间溢出。样例1/\25/\\346Theflattenedtreeshouldlooklike:1\2\3\4\5\6挑战不使用额外的空间耗费。难度等级:容易分析:本题采用递归的方法解决,关键是要知道由
nawuyao
·
2016-04-08 11:43
lintcode
[
LintCode
][Sort][Heap] Kth Largest Element
ProblemMoreDiscussionsFindK-thlargestelementinanarray.ExampleInarray[9,3,2,4,8],the3rdlargestelementis4.Inarray[1,2,3,4,5],the1stlargestelementis5,2ndlargestelementis4,3rdlargestelementis3andetc.Chall
楷书
·
2016-04-08 03:36
lintcode
(480)——二叉树的所有路径
问题描述:给一棵二叉树,找出从根节点到叶子节点的所有路径样例给出下面这棵二叉树:1/\23\5所有根到叶子的路径为:[“1->2->5”,“1->3”]分析:一般二叉树的问题用递归解决比较简洁。在库文件string中,to_string(intvalue)是把一个整数转换为字符串;两个字符串使用“+”连接,是字符串的无空格连接,这点需要了解下面给出代码:/***DefinitionofTreeNo
nawuyao
·
2016-04-07 17:27
lintcode
Lintcode
:买卖股票的最佳时机
Lintcode
:买卖股票的最佳时机classSolution: """@paramprices:Givenanintegerarray@return:Maximumprofit""" defmaxProfit
u012225151
·
2016-04-07 15:00
二叉树的遍历
在
lintcode
上,就这四种方法,就分别有一道题目与之对应。当然,题目永远是次要,通过题目理解二叉树的构
guoziqing506
·
2016-04-04 19:00
二叉树
遍历
LintCode
最小调整代价
问题描述:给一个整数数组,调整每个数的大小,使得相邻的两个数的差小于一个给定的整数target,调整每个数的代价为调整前后的差的绝对值,求调整代价之和最小是多少。你可以假设数组中每个整数都是正整数,且小于等于100。样例对于数组[1,4,2,3]和target=1,最小的调整方案是调整为[2,3,2,3],调整代价之和是2。返回2。本问题与背包问题的求解方法类似,可以用动态规划解决。i表示数组第i
ziyue225
·
2016-03-30 00:43
刷题心得
LintCode
最大间距
http://www.
lintcode
.com/zh-cn/problem/maximum-gap/最大间距查看运行结果给定一个未经排序的数组,请找出其排序表中连续两个要素的最大间距。
Arnold134777
·
2016-03-26 21:57
LintCode
最长上升子序列
给定一个整数序列,找到最长上升子序列(LIS),返回LIS的长度。说明最长上升子序列的定义:最长上升子序列问题是在一个无序的给定序列中找到一个尽可能长的由低到高排列的子序列,这种子序列不一定是连续的或者唯一的。https://en.wikipedia.org/wiki/Longest_common_subsequence_problem样例给出[5,4,1,2,3],这个LIS是[1,2,3],返
Arnold134777
·
2016-03-26 21:45
上一页
69
70
71
72
73
74
75
76
下一页
按字母分类:
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
其他