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
360 Sliding Window Median solution 题解
【题目描述】Givenanarrayofninteger,andamovingwindow(sizek),movethewindowateachiterationfromthestartofthearray,findthemedianoftheelementinsidethewindowateachmoving.(Ifthereareevennumbersinthearray,returntheN
程风破浪会有时
·
2020-02-11 22:20
小米面经-技术岗(编程小白如何进阶)
我对比了几家刷题的网站,最后选了
Lintcode
(http://www.lint
长在阳台的小精灵
·
2020-02-11 20:17
Lintcode
123 Word Search solution 题解
【题目描述】Givena2Dboardandaword,findifthewordexistsinthegrid.Thewordcanbeconstructedfromlettersofsequentiallyadjacentcell,where"adjacent"cellsarethosehorizontallyorverticallyneighboring.Thesamelettercellm
程风破浪会有时
·
2020-02-11 17:32
全排列
1,2,3],其全排列为:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]和子集的差别就是一个start,一个是visited数组https://www.
lintcode
.com
只为此心无垠
·
2020-02-11 13:42
重复
http://www.
lintcode
.com/zh-cn/problem/repeated-dna/importjava.util.ArrayList;importjava.util.List;publicclassSolution
天街孤独
·
2020-02-11 11:07
Maximum Submatrix
https://www.
lintcode
.com/problem/maximum-submatrix/descriptionpublicclassSolution{/***@parammatrix:thegivenmatrix
天街孤独
·
2020-02-11 09:33
刷题--双指针(2)
中有没有target-nums[i],如果没有将nums[i]入map用双指针法,时间复杂度O(n+nlogn),空间复杂度O(1)首先要对数组进行排序,如果要求的是返回两个数的索引,那么就不能用这个方法例
lintcode
56
王木茶
·
2020-02-11 06:00
LintCode
443 [Two Sum II]
原题给一组整数,问能找出多少对整数,他们的和大于一个给定的目标值。样例对于numbers=[2,7,11,15],target=24的情况,返回1。因为只有11+15可以大于24。解题思路借鉴TwoSum的解法-TwoPointers(对撞型指针)首先数组要排序,然后i在头,j在尾如果numbers[i]+numbers[j]>target,不需要考虑numbers[i+1~j-1]+number
Jason_Yuan
·
2020-02-11 06:36
LintCode
206 [Interval Sum I]
原题给定一个整数数组(下标由0到n-1,其中n表示数组的规模),以及一个查询列表。每一个查询列表有两个整数[start,end]。对于每个查询,计算出数组中从下标start到end之间的数的总和,并返回在结果列表中。对于数组[1,2,7,8,5],查询[(1,2),(0,4),(2,4)],返回[9,23,20]解题思路建立下标型线段树,自下而上,回溯更新root.sum=root.left.su
Jason_Yuan
·
2020-02-11 03:56
Super Pow
https://www.
lintcode
.com/problem/super-pow/descriptionpublicclassSolution{/***@parama:thegivennumbera
天街孤独
·
2020-02-10 17:48
LintCode
439 [Segment Tree Build II]
原题线段树是一棵二叉树,他的每个节点包含了两个额外的属性start和end用于表示该节点所代表的区间。start和end都是整数,并按照如下的方式赋值:根节点的start和end由build方法所给出。对于节点A的左儿子,有start=A.left,end=(A.left+A.right)/2。对于节点A的右儿子,有start=(A.left+A.right)/2+1,end=A.right。如果
Jason_Yuan
·
2020-02-10 16:11
OJ
lintcode
丑数
写一个程序来检测一个整数是不是丑数。丑数的定义是,只包含质因子2,3,5的正整数。比如6,8就是丑数,但是14不是丑数以为他包含了质因子7。注意事项可以认为1是一个特殊的丑数。您在真实的面试中是否遇到过这个题?Yes样例给出num=8,返回true。给出num=14,返回false。classSolution{public:/***@paramnumaninteger*@returntrueifn
zhaozhengcoder
·
2020-02-10 03:51
LintCode
511 [Swap Two Nodes in Linked List]
原题给你一个链表以及两个权值v1和v2,交换链表中权值为v1和v2的这两个节点。保证链表中节点权值各不相同,如果没有找到对应节点,那么什么也不用做。解题思路基础的链表操作,写一个helper函数,根据head和value找出和value相等的节点和prev节点比如给出3->4->1->5->Null和1返回Node(4)和Node(1)注意边界情况,如果v1=4,v2=1那么current1和pr
Jason_Yuan
·
2020-02-10 01:32
Subarray Product Less Than K
https://www.
lintcode
.com/problem/subarray-product-less-than-k/descriptionpublicclassSolution{/***@paramnums
天街孤独
·
2020-02-10 00:40
Lintcode
72 Construct Binary Tree from Inorder and Postorder Traversal solution 题解
constructthebinarytree.Notice:Youmayassumethatduplicatesdonotexistinthetree.根据中序遍历和后序遍历树构造二叉树注意:你可以假设树中不存在相同数值的节点【题目链接】www.
lintcode
.com
程风破浪会有时
·
2020-02-09 05:38
71. Binary Tree Zigzag Level Order Traversal
题目https://www.
lintcode
.com/problem/construct-binary-tree-from-inorder-and-postorder-traversal/description
严海翔
·
2020-02-09 03:13
LintCode
110 最小路径和
问题:给定一个只含非负整数的m*n网格,找到一条从左上角到右下角的可以使数字和最小的路径。你在同一时间只能向下或者向右移动一步分析:F(n,m)表示棋盘大小为n*m时走法数量F(n,m)=F(n-1,m)+F(n,m-1)棋盘退化成条状时边界处理(此时只有一个方向)代码:直观理解,开二维数组intminPathSum(vector>&grid){//writeyourcodehereintm=gr
留十夜
·
2020-02-09 02:30
73. Construct Binary Tree from Preorder and Inorder Traversal
题目https://www.
lintcode
.com/problem/construct-binary-tree-from-preorder-and-inorder-traversal/description
严海翔
·
2020-02-08 19:08
Max Tree
Questionfrom
lintcode
Givenanintegerarraywithnoduplicates.Amaxtreebuildingonthisarrayisdefinedasfollow:
Star_C
·
2020-02-08 17:27
动态规划解题步骤
求最大最小值-从左上角走到左下角路径的最大数字之和求存在性-博弈中,是否存在红方胜的解2.解题步骤以下都是以
lintcode
中第669题为例:“给出面额为2,5,7的硬币以及总金额为27.写一个方法来计算给出的总金额可以换取的最少的硬币数量
yuan_404
·
2020-02-08 11:02
数据结构及算法
算法
动态规划
Pyramid Transition Matrix
https://www.
lintcode
.com/problem/pyramid-transition-matrix/descriptionimportjava.util.ArrayList;importjava.util.HashMap
天街孤独
·
2020-02-08 10:56
Split Concatenated Strings
https://www.
lintcode
.com/problem/split-concatenated-strings/descriptionimportjava.util.List;publicclassSolution
天街孤独
·
2020-02-08 05:31
Lintcode
172 Remove Element solution 题解
【题目描述】Givenanarrayandavalue,removealloccurrencesofthatvalueinplaceandreturnthenewlength.Theorderofelementscanbechanged,andtheelementsafterthenewlengthdon'tmatter.给定一个数组和一个值,在原地删除与值相同的数字,返回新数组的长度。元素的顺序
程风破浪会有时
·
2020-02-08 04:51
98. Sort List
题目https://www.
lintcode
.com/problem/sort-list/description?
严海翔
·
2020-02-08 00:19
166. Nth to Last Node in List
题目https://www.
lintcode
.com/problem/nth-to-last-node-in-list/description?
严海翔
·
2020-02-08 00:09
Find Permutation
https://www.
lintcode
.com/problem/find-permutation/descriptionpublicclassSolution{/***@params:astring*
天街孤独
·
2020-02-07 23:56
LintCode
205 [Interval Minimum Number]
原题给定一个整数数组(下标由0到n-1,其中n表示数组的规模),以及一个查询列表。每一个查询列表有两个整数[start,end]。对于每个查询,计算出数组中从下标start到end之间的数的最小值,并返回在结果列表中。对于数组[1,2,7,8,5],查询[(1,2),(0,4),(2,4)],返回[2,1,5]解题思路使用线段树,典型例题首先构造node类,实现Query和Build完整代码"""
Jason_Yuan
·
2020-02-07 11:09
刷题--双指针(1)
相向双指针:两个指针一头一尾reverse类:1三步翻转法2验证回文串例
lintcode
415.ValidPalindromehttps://www.
lintcode
.com/problem/valid-palindrome
王木茶
·
2020-02-07 10:00
[
LintCode
][System Design] Singleton
ProblemMoreLeetCodeDiscussionsSingletonisamostwidelyuseddesignpattern.Ifaclasshasandonlyhasoneinstanceateverymoment,wecallthisdesignassingleton.Forexample,forclassMouse(notaanimalmouse),weshoulddesign
楷书
·
2020-02-07 10:50
Convert a Number to Hexadecimal
https://www.
lintcode
.com/problem/convert-a-number-to-hexadecimal/descriptionpublicclassSolution{/***@
天街孤独
·
2020-02-07 09:33
87. Remove Node in Binary Search Tree
题目https://www.
lintcode
.com/problem/remove-node-in-binary-search-tree/description?
严海翔
·
2020-02-07 07:09
刷题--二分法相关--三步翻转法
例
lintcode
39.RecoverRotatedSortedArrayhttps://www.
lintcode
.com/problem/recover-rotated-sorted-array/description
王木茶
·
2020-02-07 06:00
102. Linked List Cycle
题目https://www.
lintcode
.com/problem/linked-list-cycle/description?
严海翔
·
2020-02-06 23:41
阶乘除法的最后一位数
http://www.
lintcode
.com/zh-cn/problem/last-digit-by-factorial-divide/publicclassSolution{/***@paramA:
天街孤独
·
2020-02-06 22:29
滑动窗口的中位数
题目这是
lintcode
上的一道题,上次看别人发了后自己试着写了一下。感觉是比较没有技术含量的解题思路吧,而且上次面试时候也有遇到过,就当做个记录。
神棄丶Aria
·
2020-02-06 04:40
K-diff Pairs in an Array
https://www.
lintcode
.com/problem/k-diff-pairs-in-an-array/descriptionimportjava.util.Map;importjava.util.TreeMap
天街孤独
·
2020-02-05 20:11
163. Unique Binary Search Trees
题目https://www.
lintcode
.com/problem/unique-binary-search-trees/description?
严海翔
·
2020-02-05 14:45
167. Add Two Numbers
题目https://www.
lintcode
.com/problem/add-two-numbers/description?
严海翔
·
2020-02-05 12:55
刷题--二叉树(2)
二叉树结构变化例
lintcode
453.FlattenBinaryTreetoLinkedListhttps://www.
lintcode
.com/problem/flatten-binary-tree-to-linked-list
王木茶
·
2020-02-05 04:00
刷题--二叉树(1)
traversal递归没有返回值,需要一个全局变量分治divide&conquer递归有返回值分治法--遇到二叉树问题,想想整棵树在问题上的结果和左右子树在该问题上的结果之间的联系是什么一二叉树上求值,求路径例
lintcode
596
王木茶
·
2020-02-04 10:00
调整数组顺序使奇数位于偶数前面
注意本题和
lintcode
上的快排变形题有区别,快排本身无法保证排序的稳定性,题目要求偶数和奇数的相对位置不能变代码插入排序思想,空间复杂度为O(1),时间复杂度为O(N^2)publicclassSolution
6默默Welsh
·
2020-02-02 09:39
LintCode
111 爬楼梯
问题:假设你正在爬楼梯,需要n步你才能到达顶部。但每次你只能爬一步或者两步,你能有多少种不同的方法爬到楼顶部?分析:其实就是斐波那契数列的应用,递推公式为:f(i)=f(i-1)+f(i-2)可以直观的使用递归,但是时间复杂度与规模n成指数关系,下面介绍动态规划解法。代码:intclimbStairs(intn){//开一个长度为n+1的数组记录状态,也称‘打表’if(n==0){return1;
留十夜
·
2020-02-01 21:51
LintCode
主元素 III
题目给定一个整型数组,找到主元素,它在数组中的出现次数严格大于数组元素个数的1/k。注意事项数组中只有唯一的主元素样例给出数组[3,1,2,3,2,3,3,4,4,4],和k=3,返回3分析我们的基本做法如下:首先,先要搞清楚这个问题在数学上的原理。既然主元素的判定标准是个数大于数组长度的1/k,那换句话说,就是满足如下的公式:x/n>1/k其中,我假设x为主元素,n为数组长度。然后,将这个公式两
六尺帐篷
·
2020-02-01 13:27
刷题--二分法(4)
例
lintcode
183.WoodCuthttps://www.
lintcode
.com/problem/wood-cut/description从考虑答案的角度,切割长度从1开始增加,长度为1的时候可能切出几百根
王木茶
·
2020-01-31 23:00
A+B问题
lintcode
算法题1.A+B问题描述给出两个整数a和b,求他们的和。你不需要从输入流读入数据,只需要根据aplusb的两个参数a和b,计算他们的和并返回就行。说明a和b都是32位整数么?是的。
阿丹_90
·
2020-01-15 16:23
lintcode
入门篇四
142.O(1)时间检测2的幂次用O(1)时间检测整数n是否是2的幂次。样例Example1:Input:4Output:trueExample2:Input:5Output:false挑战O(1)time第一种方法:&的方法classSolution:"""@paramn:Aninteger@return:Trueorfalse"""'''1.使用递归的方法来进行判断2.相与的方法来进行判断比如
风不再来
·
2020-01-15 10:00
Edit Distance(编辑距离)
http://www.
lintcode
.com/en/problem/edit-distance/publicclassSolution{/**@paramword1:Astring*@paramword2
天街孤独
·
2020-01-08 21:53
Matchsticks to Square
https://www.
lintcode
.com/problem/matchsticks-to-square/descriptionimportjava.util.Arrays;publicclassSolution
天街孤独
·
2020-01-08 20:45
LintCode
617. 最大平均值子数组
原题解第一步,万年不变的查错。如果给的array是null或空,那么直接return。publicdoublemaxAverage(int[]nums,intk){if(nums==null||nums.length==0){return0;}...}思路首先就是因为要找subarray的最大平均值,肯定需要知道每一个subarray的和,所以肯定就得用prefixsum。先把prefixsum做
Jay_8d33
·
2020-01-08 18:57
Triangle Count(三角形计数)
http://www.
lintcode
.com/zh-cn/problem/triangle-count/?
天街孤独
·
2020-01-08 14:03
上一页
47
48
49
50
51
52
53
54
下一页
按字母分类:
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
其他