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
Count Numbers with Unique Digits
https://www.
lintcode
.com/problem/count-numbers-with-unique-digits/descriptionpublicclassSolution{/***
天街孤独
·
2020-04-13 19:48
Merge 2 sorted array
Questionfrom
lintcode
Thisisaverybasicbuthighlyfrequentlyaskedquestion.Ihavemetthisquestionintheuniversityclass
Star_C
·
2020-04-13 18:47
lintCode
真题实战-入门题集/矩阵面积/整数排序
1.矩阵面积实现一个矩阵类Rectangle,包含如下的一些成员变量与函数:两个共有的成员变量width和height分别代表宽度和高度。一个构造函数,接受2个参数width和height来设定矩阵的宽度和高度。一个成员函数getArea,返回这个矩阵的面积。样例Python:rec=Rectangle(3,4)rec.getArea()解答:classRectangle:#简单,主要考察对类方法
时间之友
·
2020-04-13 17:54
lintcode
斐波纳契数列
查找斐波纳契数列中第N个数。所谓的斐波纳契数列是指:前2个数是0和1。第i个数是第i-1个数和第i-2个数的和。斐波纳契数列的前10个数字是:0,1,1,2,3,5,8,13,21,34...您在真实的面试中是否遇到过这个题?Yes样例给定1,返回0给定2,返回1给定10,返回34classSolution{public:/***@paramn:aninteger*@returnaninteger
zhaozhengcoder
·
2020-04-13 16:51
LintCode
- Add Digits(普通)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:容易要求:Givenanon-negativeintegernum,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.样例Givennum=38.Theprocessislike:3+8=11,1+1=2.Since2hasonlyonedigit,return2.思路:publi
柒黍
·
2020-04-13 13:13
Lintcode
550 Top K Frequent Words II 题解
【题目描述】Findtopkfrequentwordsinrealtimedatastream.ImplementthreemethodsforTopkClass:1.TopK(k).Theconstructor.2.add(word).Addanewword.3.topk().Getthecurrenttopkfrequentwords.Notice:Iftwowordshavethesamef
plai_d75a
·
2020-04-13 06:37
Hex Conversion
http://www.
lintcode
.com/zh-cn/problem/hex-conversion/publicclassSolution{/***@paramn:adecimalnumber*@
天街孤独
·
2020-04-13 00:47
LintCode
-60.搜索插入位置
题目描述实现一个带有取最小值min方法的栈,min方法将返回当前栈中的最小值。你实现的栈将支持push,pop和min操作,所有操作要求都在O(1)时间内完成。样例如下操作:push(1),pop(),push(2),push(3),min(),push(1),min()返回1,2,1解答思路建立两个栈,一个保持顶端是最小的数,另一个保存剩下的数据。代码publicclassSolution{/*
悠扬前奏
·
2020-04-12 23:18
106. Convert Sorted List to Binary Search Tree
题目https://www.
lintcode
.com/problem/convert-sorted-list-to-binary-search-tree/description?
严海翔
·
2020-04-12 20:07
[
LintCode
][System Design] Web Logger
ProblemMoreDiscussionsImplementaweblogger,whichprovidetwomethods:hit(timestamp),recordahitatgiventimestamp.get_hit_count_in_last_5_minutes(timestamp),gethitcountinlast5minutes.thetwomethodswillbecalle
楷书
·
2020-04-12 17:43
Lintcode
203 Segment Tree Modify solution 题解
【题目描述】ForaMaximumSegmentTree,whicheachnodehasanextravaluemaxtostorethemaximumvalueinthisnode'sinterval.Implementamodifyfunctionwiththreeparameterroot,indexandvaluetochangethenode'svaluewith[start,end]
程风破浪会有时
·
2020-04-12 16:35
lintcode
子集和带重复数字的子集
第十七题是给定一个不含重复数字的集合,返回其子集;十八题是给定一个可能有重复数字的集合,返回其子集。先来说没有重复数字的情况首先把空集合加进去,然后在循环里面进行递归调用,在进行递归时,将i的值加1,就可以排除前面已经加进去的数字,这道题可以和十五十六题进行比较,都属于深度优先搜索。代码如下:classSolution{public:/***@paramS:Asetofnumbers.*@retu
yzawyx0220
·
2020-04-12 11:18
LintCode
70. Binary Tree Level Order Traversal II
原题
LintCode
70.BinaryTreeLevelOrderTraversalIIDescriptionGivenabinarytree,returnthebottom-uplevelordertraversalofitsnodes'values
Andiedie
·
2020-04-12 07:57
Lintcode
393 Best Time to Buy and Sell Stock IV solution 题解
【题目描述】Sayyouhaveanarrayforwhichtheithelementisthepriceofagivenstockondayi.Designanalgorithmtofindthemaximumprofit.Youmaycompleteatmostktransactions.Notice:Youmaynotengageinmultipletransactionsatthesam
程风破浪会有时
·
2020-04-12 02:16
LintCode
- 最长单词(普通)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:容易要求:给一个词典,找出其中所有最长的单词。样例给一个词典,找出其中所有最长的单词。在词典{"dog","google","facebook","internationalization","blabla"}中,最长的单词集合为["internationalization"]在词典{"like","love","hate","yes"}中
柒黍
·
2020-04-11 21:37
Lintcode
28 Search a 2D Matrix solution 题解
【题目描述】Writeanefficientalgorithmthatsearchesforavalueinanmxnmatrix.Thismatrixhasthefollowingproperties:Integersineachrowaresortedfromlefttoright.Thefirstintegerofeachrowisgreaterthanthelastintegerofthe
代码码着玩
·
2020-04-11 20:55
LintCode
寻找旋转排序数组中的最小值 II
题目假设一个旋转排序的数组其起始位置是未知的(比如0124567可能变成是4567012)。你需要找到其中最小的元素。数组中可能存在重复的元素。样例给出[4,4,5,6,7,0,1,2]返回0分析这次可以出现重复元素,很简单,只要判断的时候加等于的判断即可,如果mid等于end,那么end--最小值肯定还在其中。代码publicclassSolution{/***@paramnum:arotate
六尺帐篷
·
2020-04-11 17:12
LintCode
问题图解-13
本文准备讲解1个简单的算法编程问题,这个算法编程问题来自
LintCode
平台。不了解.
LintCode
平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。
billliu_0d62
·
2020-04-11 17:33
Sliding Window Problem Summary (
Lintcode
360, Leetcode 239)
Lintcode
360:SlidingWindow找median。这道题最好先减再加,用的是基本的twopriorityqueue的方法。classSolution{p
stepsma
·
2020-04-11 14:30
Lintcode
6 Merge Two Sorted Arrays solution 题解
【题目链接】http://www.
lintcode
.com/en/problem/merge-two-sorted-arrays/【题目解析】A和B都已经是排好序的数组,我们只需要从后往前比较就可以了。
代码码着玩
·
2020-04-11 09:26
LintCode
-187. 加油站
题目描述在一条环路上有N个加油站,其中第i个加油站有汽油gas[i],并且从第i个加油站前往第i+1个加油站需要消耗汽油cost[i]。你有一辆油箱容量无限大的汽车,现在要从某一个加油站出发绕环路一周,一开始油箱为空。求可环绕环路一周时出发的加油站的编号,若不存在环绕一周的方案,则返回-1。注意事项:数据保证答案唯一。样例现在有4个加油站,汽油量gas[i]=[1,1,3,1],环路旅行时消耗的汽
悠扬前奏
·
2020-04-11 05:28
OJ
lintcode
统计比给定整数小的数的个数
给定一个整数数组(下标由0到n-1,其中n表示数组的规模,数值范围由0到10000),以及一个查询列表。对于每一个查询,将会给你一个整数,请你返回该数组中小于给定整数的元素的数量。注意事项在做此题前,最好先完成线段树的构造and线段树查询II这两道题目。您在真实的面试中是否遇到过这个题?Yes样例对于数组[1,2,7,8,5],查询[1,8,5],返回[0,4,2]classSolution{pu
zhaozhengcoder
·
2020-04-11 04:59
LintCode
-454.矩阵面积
题目描述实现一个矩阵类Rectangle,包含如下的一些成员变量与函数:两个共有的成员变量width和height分别代表宽度和高度。一个构造函数,接受2个参数width和height来设定矩阵的宽度和高度。一个成员函数getArea,返回这个矩阵的面积。样例Rectanglerec=newRectangle(3,4);rec.getArea();//shouldget12解答太简单了。不多说代码
悠扬前奏
·
2020-04-11 02:53
Minimum Index Sum of Two Lists
https://www.
lintcode
.com/problem/minimum-index-sum-of-two-lists/descriptionimportjava.util.ArrayList;
天街孤独
·
2020-04-11 02:10
Minimum Factorization
http://www.
lintcode
.com/zh-cn/problem/minimum-factorization/importjava.util.ArrayList;importjava.util.Collections
天街孤独
·
2020-04-11 02:20
lintcode
-删除排序数组中的重复数字
删除排序数组中的重复数字利用库函数,偷懒法classSolution{public:/***@paramA:alistofintegers*@return:returnaninteger*/intremoveDuplicates(vector&nums){//writeyourcodeherenums.erase(unique(nums.begin(),nums.end()),nums.end()
鬼谷神奇
·
2020-04-11 01:18
LintCode
主元素 II
题目给定一个整型数组,找到主元素,它在数组中的出现次数严格大于数组元素个数的三分之一。**注意事项**数组中只有唯一的主元素样例给出数组[1,2,1,2,1,3,3]返回1分析三三抵销法,但是也有需要注意的地方:我们对cnt1,cnt2减数时,相当于丢弃了3个数字(当前数字,candidate1,candidate2)。也就是说,每一次丢弃数字,我们是丢弃3个不同的数字。而Majoritynumb
六尺帐篷
·
2020-04-10 20:25
Word Ladder (单词接龙)
http://www.
lintcode
.com/en/problem/word-ladder/packagecom.
LintCode
.WordLadder;importjava.util.ArrayList
天街孤独
·
2020-04-10 19:46
LintCode
问题图解-29
本文准备讲解1个简单的算法编程问题,这个算法编程问题来自
LintCode
平台。不了解.
LintCode
平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。
billliu_0d62
·
2020-04-10 19:55
Java 算法-拓扑排序(深搜或者广搜)
说实话,在数据结构中,拓扑排序我掌握的不是很好,今天在
lintCode
上面做了关于拓扑排序的题,才开始还是有点懵逼,后面的渐渐的分析,还是做出来了。在这里只是做一个记录,随便巩固一下深搜和广搜。
琼珶和予
·
2020-04-10 06:59
Lintcode
400 Maximum Gap solution 题解
【题目描述】Givenanunsortedarray,findthemaximumdifferencebetweenthesuccessiveelementsinitssortedform.Return0ifthearraycontainslessthan2elements.Notice:Youmayassumeallelementsinthearrayarenon-negativeinteger
程风破浪会有时
·
2020-04-10 03:59
lintcode
学习一
1.把一个数倒序reverse(x)intres=0;while(x!=0){inttemp=res*10+x%10;x=x/10;if((temp/10)!=0){res=0;break;}res=temp;}returnres;}2.求一个阶乘的尾数是零的个数思路:num=x/5;x=x/5;3.求a+b,不用+运算思路:num=a^b;t=(a&b)<<1;当t为0时,结束运算返回num.
幻影翔
·
2020-04-10 01:18
LintCode
数字组合
题目给出一组候选数字(C)和目标数字(T),找到C中所有的组合,使找出的数字和为T。C中的数字可以无限制重复被选取。例如,给出候选数组[2,3,6,7]和目标数字7,所求的解为:[7],[2,2,3]注意事项所有的数字(包括目标数字)均为正整数。元素组合(a1,a2,…,ak)必须是非降序(ie,a1≤a2≤…≤ak)。解集不能包含重复的组合。样例给出候选数组[2,3,6,7]和目标数字7返回[[
六尺帐篷
·
2020-04-10 00:43
AND and OR
https://www.
lintcode
.com/problem/and-and-or/descriptionpublicclassSolution{/***@paramn:*@paramnums:*@
天街孤独
·
2020-04-10 00:11
Functional Programming: Expression Expand solve with recursion (not using a stack)
Questionfrom
lintcode
Givenanexpressionsincludesnumbers,lettersandbrackets.Numberrepresentsthenumberofrepetitionsinsidethebrackets
Star_C
·
2020-04-09 22:02
刷
Lintcode
:删除排序数组中的重复数字
描述:给定一个排序数组,在原数组中删除重复出现的数字,使得每个元素只出现一次,并且返回新的数组的长度。不要使用额外的数组空间,必须在原地没有额外空间的条件下完成。样例给出数组A=[1,1,2],你的函数应该返回长度2,此时A=[1,2]。我的代码:答案显示输出是对的,但是还是报错。50%;不知道错在哪儿了。标准答案:答案利用了数组原本已经排好序的特点,说实话比我的答案强。不知道是不是因为我调用了排
2a25936eedd9
·
2020-04-09 22:42
454. Rectangle Area
[http://www.
lintcode
.com/en/problem/rectangle-area/]#PythonclassRectangle:'''*Defineaconstructorwhichexpectstwoparameterswidthandheighthere
fdgump
·
2020-04-09 22:54
[
Lintcode
][java]删除链表中的元素
删除链表中等于给定值val的所有节点。样例给出链表1->2->3->3->4->5->3,和val=3,你需要返回删除3之后的链表:1->2->4->5。/***Definitionforsingly-linkedlist.*publicclassListNode{*intval;*ListNodenext;*ListNode(intx){val=x;}*}*/publicclassSolutio
第六象限
·
2020-04-09 20:13
LintCode
硬币排成线
题目有n个硬币排成一条线。两个参赛者轮流从右边依次拿走1或2个硬币,直到没有硬币为止。拿到最后一枚硬币的人获胜。请判定第一个玩家是输还是赢?**样例**n=1,返回true.n=2,返回true.n=3,返回false.n=4,返回true.n=5,返回true.分析这道题是典型的博弈论,显然每次我们都是三个三个循环,如果我先拿,我拿一个,对方可以拿两个,我拿两个,对方可以拿一个,所以如果总数是三
六尺帐篷
·
2020-04-09 20:03
我的
Lintcode
之路——删除数字
给出一个字符串A,表示一个n位正整数,删除其中k位数字,使得剩余的数字仍然按照原来的顺序排列产生一个新的正整数。找到删除k个数字之后的最小正整数。N0){intflag=1;if(step==length-k)//如果是第一次的话,就让flag=0;{flag=0;}charmin=58;for(inti=index+flag;i<=k+j;i++){inttemp=array[i]-min;if
徐不歪了
·
2020-04-09 13:27
Palindrome Permutation
http://www.
lintcode
.com/zh-cn/problem/palindrome-permutation/importjava.util.HashMap;importjava.util.Iterator
天街孤独
·
2020-04-09 11:52
[
LintCode
]整数排序
问题
LintCode
:整数排序描述给一组整数,按照升序排序,使用选择排序,冒泡排序,插入排序或者任何O(n2)的排序算法。样例对于数组[3,2,1,4,5],排序后为:[1,2,3,4,5]。
華方
·
2020-04-09 10:39
LintCode
- 将整数A转换为B(普通)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:容易要求:如果要将整数A转换为B,需要改变多少个bit位?样例给出A=[1,2,3,4],B=[2,4,5,6],返回**[1,2,2,3,4,4,5,6]**思路:/***@parama,b:Twointeger*return:Aninteger*/publicstaticintbitSwapRequired(inta,intb){//w
柒黍
·
2020-04-09 07:47
107. 单词拆分 I
样例给出s="
lintcode
",dict=["lint","code"],返回true因为"
lintcode
"可以被空格切分成"
lintcode
"思路动态规划的本质:根据已知结论推理未知结论s=
lintcode
6默默Welsh
·
2020-04-08 18:36
LintCode
二叉树的锯齿形层次遍历
题目给出一棵二叉树,返回其节点值的锯齿形层次遍历(先从左往右,下一层再从右往左,层与层之间交替进行)Paste_Image.png分析较为简单,直接在层次遍历的基础上改,将偶数行反转即可,可以加一个boolean变量判断,也可以最后直接在res上反转代码/***DefinitionofTreeNode:*publicclassTreeNode{*publicintval;*publicTreeNo
六尺帐篷
·
2020-04-08 09:27
[
LintCode
][2Sum] Triangle Count
ProblemMoreDiscussionsGivenanarrayofintegers,howmanythreenumberscanbefoundinthearray,sothatwecanbuildantrianglewhosethreeedgeslengthisthethreenumbersthatwefind?ExampleGivenarrayS=[3,4,6,7],return3.The
楷书
·
2020-04-08 06:22
LintCode
排颜色 II
题目给定一个有n个对象(包括k种不同的颜色,并按照1到k进行编号)的数组,将对象进行分类使相同颜色的对象相邻,并按照1,2,...k的顺序进行排序。注意事项Youarenotsupposetousethelibrary'ssortfunctionforthisproblem.k=right){return;}intcolorMid=(colorFrom+colorTo)/2;intl=left,r
六尺帐篷
·
2020-04-08 05:52
OJ:
lintcode
整数排序
给一组整数,按照升序排序,使用选择排序,冒泡排序,插入排序或者任何O(n2)的排序算法。您在真实的面试中是否遇到过这个题?Yes样例对于数组[3,2,1,4,5],排序后为:[1,2,3,4,5]。classSolution{public:/***@paramAanintegerarray*@returnvoid*/voidsortIntegers(vector&A){//Writeyourcod
zhaozhengcoder
·
2020-04-08 04:52
Lintcode
165 Merge Two Sorted Lists solution 题解
【题目链接】www.
lintcode
程风破浪会有时
·
2020-04-08 04:30
Lintcode
372 Delete Node in the Middle of Singly Linked List solution 题解
【题目链接】www.
lintcode
.com/en/problem/delete-node-in-the-mid
程风破浪会有时
·
2020-04-07 18:26
上一页
36
37
38
39
40
41
42
43
下一页
按字母分类:
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
其他