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
翻转链表 II
题目翻转链表中第m个节点到第n个节点的部分注意事项m,n满足1≤m≤n≤链表长度代码/***DefinitionforListNode*publicclassListNode{*intval;*ListNodenext;*ListNode(intx){*val=x;*next=null;*}*}*/publicclassSolution{/***@paramListNodeheadisthehea
六尺帐篷
·
2019-12-15 07:32
LintCode
格雷编码
题目格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个二进制的差异。给定一个非负整数n,表示该代码中所有二进制的总数,请找出其格雷编码顺序。一个格雷编码顺序必须以0开始,并覆盖所有的2n个整数。注意事项对于给定的n,其格雷编码顺序并不唯一。根据以上定义,[0,2,3,1]也是一个有效的格雷编码顺序。样例给定n=2,返回[0,1,3,2]。其格雷编码顺序为:00-001-111-310
六尺帐篷
·
2019-12-15 03:30
LintCode
11 [Search Range In Binary Search Tree]
原题给定两个值k1和k2(k1start则可以继续左子树如果root.val=startandroot.valstart:self.dfs(root.left,start,end,result)ifroot.val>=startandroot.val<=end:result.append(root.val)ifroot.val
Jason_Yuan
·
2019-12-15 00:40
lintcode
搜索插入位置
样例[1,3,5,6],5→2[1,3,5,6],2→1[1,3,5,6],7→4[1,3,5,6],0→0题目链接:http://www.
lintcode
.com/zh-cn/problem/search-insert-position
yzawyx0220
·
2019-12-15 00:11
Sliding Window Unique Elements Sum()
http://www.
lintcode
.com/zh-cn/problem/sliding-window-unique-elements-sum/?
天街孤独
·
2019-12-15 00:20
Construct Binary Tree from String
http://www.
lintcode
.com/zh-cn/problem/construct-binary-tree-from-string//***DefinitionofTreeNode:*publicclassTreeNode
天街孤独
·
2019-12-14 22:26
Longest Word in Dictionary through Deleting
https://www.
lintcode
.com/problem/longest-word-in-dictionary-through-deleting/descriptionimportjava.util.Collections
天街孤独
·
2019-12-14 20:13
LintCode
问题图解-9
本文准备讲解1个简单的算法编程问题,这个算法编程问题来自
LintCode
平台。不了解.
LintCode
平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。
billliu_0d62
·
2019-12-14 15:39
Lintcode
154 Regular Expression Matching solution 题解
【题目描述】Implementregularexpressionmatchingwithsupportfor'.'and'*'.'.'Matchesanysinglecharacter.'*'Matcheszeroormoreoftheprecedingelement.Thematchingshouldcovertheentireinputstring(notpartial).Thefunctio
程风破浪会有时
·
2019-12-14 09:53
Lintcode
186 Max Points on a Line solution 题解
【题目链接】www.
lintcode
.com/en/problem/max-points-on-a-line/【题目解析】(1)两点确定一条直线(2)斜率相同的点落在一条直线
程风破浪会有时
·
2019-12-14 03:51
lintcode
翻转链表
三十五题为翻转一个单链表,三十六题为翻转链表中第m个节点到第n个节点的部分样例给出链表1->2->3->4->5->null,m=2和n=4,返回1->4->3->2->5->null。先来说三十五,翻转一个单链表。每次点到一个节点作为链表的开始即可:/***DefinitionofListNode**classListNode{*public:*intval;*ListNode*next;**L
yzawyx0220
·
2019-12-13 23:17
lintcode
88. Lowest Common Ancestor of a Binary Tree
image.pngimage.pnghttps://articles.leetcode.com/lowest-common-ancestor-of-a-binary-tree-part-i/image.png/***DefinitionofTreeNode:*classTreeNode{*public:*intval;*TreeNode*left,*right;*TreeNode(intval){
刘小小gogo
·
2019-12-13 20:36
LRU与LFU缓存算法
一、背景缓存算法也是也是我们日常使用的操作系统、应用程序内部用得比较多的一种调度算法,之前也是了解个过程没具体实现过,刚好
LintCode
上面刷题看到这两个算法,所以写这篇博客来整理一下LRUCache
丶legend
·
2019-12-13 20:17
Valid Triangle
http://www.
lintcode
.com/zh-cn/problem/valid-triangle/publicclassSolution{/***@parama:aintegerrepresentthelengthofoneedge
天街孤独
·
2019-12-13 13:17
Insert Interval(插入区间)
http://www.
lintcode
.com/en/problem/insert-interval//***DefinitionofInterval:*publicclasssInterval{*intstart
天街孤独
·
2019-12-13 12:18
LintCode
_chapter2_section1_remove-element
#coding=utf-8'''Createdon2015年11月6日@author:SphinxW'''#删除元素##给定一个数组和一个值,在原地删除与值相同的数字,返回新数组的长度。##元素的顺序可以改变,并且对新的数组不会有影响。#您在真实的面试中是否遇到过这个题?#样例##给出一个数组[0,4,4,0,0,2,4,4],和值4##返回4并且4个元素的新数组为[0,0,0,2]classSo
穆弋
·
2019-12-13 08:52
优酷面试经验分享,已拿到 offer
算法题说白了就是要刷题,我一直有在
Lintcode
刷题,所以算法题对于我
心之所向_96d3
·
2019-12-13 06:35
LintCode
398 [Longest Increasing Continuous Subsequence II]
原题给定一个整数矩阵(其中,有n行,m列),请找出矩阵中的最长上升连续子序列。(最长上升连续子序列可从任意行或任意列开始,向上/下/左/右任意方向移动)。样例给定一个矩阵[[1,2,3,4,5],[16,17,24,23,6],[15,18,25,22,7],[14,19,20,21,8],[13,12,11,10,9]]返回25解题思路类似于滑雪问题记忆化搜索-因为对于某一个点,可以从上下左右更
Jason_Yuan
·
2019-12-13 05:01
[
LintCode
][System Design] Parking Lot
ProblemMoreLeetCodeDiscussionsDesignaparkinglot.seeCC150OODesignfordetails.nlevels,eachlevelhasmrowsofspotsandeachrowhaskspots.Soeachlevelhasmxkspots.Theparkinglotcanparkmotorcycles,carsandbusesThepar
楷书
·
2019-12-13 04:14
272. Closest Binary Search Tree Value II
importkotlin.collections.ArrayList/***Lockbyleetcode*272.ClosestBinarySearchTreeValueII*https://www.
lintcode
.com
johnny_zhao
·
2019-12-13 01:00
LintCode
87 [Remove Node in Binary Search Tree]
原题给定一棵具有不同节点值的二叉查找树,删除树中与给定值相同的节点。如果树中没有相同值的节点,就不做任何处理。你应该保证处理之后的树仍是二叉查找树。样例给出如下二叉查找树:5/\36/\24删除节点3之后,你可以返回:5/\26\4或者:5/\46/2解题思路首先Inorder遍历整棵树,当数值不等于想要删除的节点的数值时,把节点加入数组利用刚刚构建的中序遍历的数组重新建立新的搜索二叉树完整代码"
Jason_Yuan
·
2019-12-13 01:32
LintCode
1042ToeplitzMatrixpublicclassSolution{/***@parammatrix:thegivenmatrix*@return:TrueifandonlyifthematrixisToeplitz*/publicbooleanisToeplitzMatrix(int[][]matrix){//Writeyourcodehereintm=matrix.length;if(
VincentJianshu
·
2019-12-12 23:56
[入门]366.斐波纳契数列
题目
LintCode
:斐波纳契数列描述查找斐波纳契数列中第N个数。所谓的斐波纳契数列是指:前2个数是0和1。第i个数是第i-1个数和第i-2个数的和。
我叫小小强
·
2019-12-12 18:08
LintCode
翻转链表
题目翻转一个链表样例给出一个链表1->2->3->null,这个翻转后的链表为3->2->1->null分析原地翻转链表,这道题对链表操作很有实践意义设置两个指针,每次交换两个节点。代码/***DefinitionforListNode.*publicclassListNode{*intval;*ListNodenext;*ListNode(intval){*this.val=val;*this.
六尺帐篷
·
2019-12-11 21:18
LintCode
两个字符串是变位词
题目写出一个函数anagram(s,t)判断两个字符串是否可以通过改变字母的顺序变成一样的字符串。样例给出s="abcd",t="dcab",返回true给出s="ab",t="ab",返回true.给出s="ab",t="ac",返回false.分析这种题目只需判断是否具有相同的字符,以及字符的数量是否相等技巧是新建一个数组用于记录,若有就加一,多个就继续加一再在另一个字符串里减一,最后如果碰到
六尺帐篷
·
2019-12-11 18:34
Lintcode
419 Roman to Integer solution 题解
【题目链接】www.
lintcode
.com/en/problem/roman-to-integer/【题目解析】从前往后扫描,用一个
程风破浪会有时
·
2019-12-08 13:47
LintCode
问题图解-30
本文准备讲解1个简单的算法编程问题,这个算法编程问题来自
LintCode
平台。不了解.
LintCode
平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。
billliu_0d62
·
2019-12-08 10:34
Single Number II(落单的数 II)
http://www.
lintcode
.com/en/problem/single-number-ii/publicclassSolution{/***@paramA:Anintegerarray*@return
天街孤独
·
2019-12-08 05:39
LintCode
- 逆波兰表达式求值(中等)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:中等要求:求逆波兰表达式的值。在逆波兰表达法中,其有效的运算符号包括+,-,*,/。每个运算对象可以是整数,也可以是另一个逆波兰计数表达。样例["2","1","+","3","*"]->((2+1)*3)->9["4","13","5","/","+"]->(4+(13/5))->6思路:栈数据结构的经典运用,知道了就简单.publicc
柒黍
·
2019-12-07 18:31
Lintcode
414 Divide Two Integers solution 题解
【题目链接】www.
lintcode
.com/en/problem/divide-two-integer
程风破浪会有时
·
2019-12-07 16:16
Lintcode
84 Single Number |||solution 题解
【题目链接】www.
lintcode
.com/en/problem/single-number-iii/【题目解析】不妨设最后两个只出现一次的数分别为x1,x2.那么遍历数组时根据两两异
程风破浪会有时
·
2019-12-07 16:49
中等题3-统计数字
题目链接:https://www.
lintcode
.com/problem/digit-counts/description描述计算数字k在0到n中的出现的次数,k可能是0~9的一个值您在真实的面试中是否遇到过这个题
Airycode
·
2019-12-07 12:55
Lintcode
87 Remove Node In Binary Search Treesolution 题解
【题目描述】GivenarootofBinarySearchTreewithuniquevalueforeachnode.Removethenodewithgivenvalue.Ifthereisnosuchanodewithgivenvalueinthebinarysearchtree,donothing.Youshouldkeepthetreestillabinarysearchtreeaft
程风破浪会有时
·
2019-12-07 07:16
LintCode
-67.二叉树的中序遍历
题目描述给出一棵二叉树,返回其中序遍历样例给出二叉树{1,#,2,3},1\2/3返回[1,3,2].解答思路中序遍历二叉树代码/***DefinitionofTreeNode:*publicclassTreeNode{*publicintval;*publicTreeNodeleft,right;*publicTreeNode(intval){*this.val=val;*this.left=t
悠扬前奏
·
2019-12-07 02:50
求包含不同整数的集合所有的子集
Lintcode
地址:http://www.
lintcode
.com/zh-cn/problem/subsets/样例:如果S=[1,2,3],有如下的解:[[3],[1],[2],[1,2,3],[1,3
牛亦非
·
2019-12-06 23:17
LintCode
最长上升连续子序列
给定一个整数数组(下标从0到n-1,n表示整个数组的规模),请找出该数组中的最长上升连续子序列。(最长上升连续子序列可以定义为从右到左或从左到右的序列。)代码如下:publicclassSolution{/***@paramAanarrayofInteger*@returnaninteger*/publicintlongestIncreasingContinuousSubsequence(int[
Arnold134777
·
2019-12-06 19:57
Lintcode
436 Maximal Square solution 题解
【题目链接】www.
lintcode
.com/en/problem/maximal-square/【题目解析】考虑以f[i][j]为右下角顶点可以拓展的正方形
程风破浪会有时
·
2019-12-06 12:27
输入流
http://www.
lintcode
.com/zh-cn/problem/input-stream/publicclassSolution{/***@paraminputA:InputstreamA*
天街孤独
·
2019-12-06 12:39
Lintcode
9 Fizz Buzz solution 题解
【题目描述】Givennumbern.Printnumberfrom1ton.But:whennumberisdividedby3,print"fizz".whennumberisdividedby5,print"buzz".whennumberisdividedbyboth3and5,print"fizzbuzz".给你一个整数n.从1到n按照下面的规则打印每个数:如果这个数被3整除,打印fiz
代码码着玩
·
2019-12-06 12:49
LintCode
--剑指offer第1--10题
1.FizzBuzz问题:给你一个整数n.从1到n按照下面的规则打印每个数:如果这个数被3整除,打印fizz.如果这个数被5整除,打印buzz.如果这个数能同时被3和5整除,打印fizzbuzz.样例:比如n=15,返回一个字符串数组:["1","2","fizz","4","buzz","fizz","7","8","fizz","buzz","11","fizz","13","14","fiz
背对背_拥_抱
·
2019-12-02 05:58
Lintcode
518 Super Ugly Number solution 题解
【题目描述】Writeaprogramtofindthenthsuperuglynumber.Superuglynumbersarepositivenumberswhoseallprimefactorsareinthegivenprimelistprimesofsizek.Forexample,[1,2,4,7,8,13,14,16,19,26,28,32]isthesequenceofthefi
程风破浪会有时
·
2019-12-02 03:09
Lintcode
517 Ugly Number solution 题解
【题目描述】Writeaprogramtocheckwhetheragivennumberisanuglynumber`.Uglynumbersarepositivenumberswhoseprimefactorsonlyinclude2,3,5.Forexample,6,8areuglywhile14isnotuglysinceitincludesanotherprimefactor7.Noti
程风破浪会有时
·
2019-12-02 01:39
Lintcode
534 House Robber II solution 题解
【题目描述】Afterrobbingthosehousesonthatstreet,thethiefhasfoundhimselfanewplaceforhisthieverysothathewillnotgettoomuchattention.Thistime,allhousesatthisplacearearrangedinacircle.Thatmeansthefirsthouseisthe
程风破浪会有时
·
2019-12-02 00:20
Lintcode
62 Search in Rotated Sorted Array solution 题解
【题目描述】Supposeasortedarrayisrotatedatsomepivotunknowntoyoubeforehand.(i.e.,0124567mightbecome4567012).Youaregivenatargetvaluetosearch.Iffoundinthearrayreturnitsindex,otherwisereturn-1.Youmayassumenodup
代码码着玩
·
2019-12-01 23:01
三数之和 II
https://www.
lintcode
.com/problem/3sum-ii/descriptionpublicclassSolution{/***@paramn:aninteger*@return
天街孤独
·
2019-12-01 18:52
Remove Node in Binary Search Tree
RemoveNodeinBinarySearchTree今天是一道题目,来自
LintCode
,难度为Hard,Acceptance为25%。
ab409
·
2019-12-01 15:11
LeetCode
LintCode
干货全集
事情是这样的.下面这个就是我在GitHub上面自动生成的
LintCode
表格.当时先做的是
LintCode
,大约有150来道。
张土汪
·
2019-12-01 13:33
LintCode
79 [Longest Common Substring]
原题给出两个字符串,找到最长公共子串,并返回其长度。样例给出A=“ABCD”,B=“CBCE”,返回2解题思路典型的双序列行动态规划-TwoSequenceDP不同于LongestCommonSubsequence,本题是substring,string要求是连续的,sequence可以是不连续的本题的状态表示类似于LongestIncreasingSubsequencecache[i][j]表示
Jason_Yuan
·
2019-12-01 11:49
LintCode
- 平衡二叉树(普通)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:容易要求:给定一个二叉树,确定它是高度平衡的。对于这个问题,一棵高度平衡的二叉树的定义是:一棵二叉树中每个节点的两个子树的深度相差不会超过1。样例给出二叉树A={3,9,20,#,#,15,7},B={3,#,20,15,7}A)3B)3/\\92020/\/\157157二叉树A是高度平衡的二叉树,但是B不是思路:可以用递归的思路求左右子
柒黍
·
2019-12-01 10:57
Lintcode
151 Best Time to Buy and Sell Stock III solution 题解
【题目描述】Sayyouhaveanarrayforwhichtheithelementisthepriceofagivenstockondayi.Designanalgorithmtofindthemaximumprofit.Youmaycompleteatmosttwotransactions.NoticeYoumaynotengageinmultipletransactionsatthesa
程风破浪会有时
·
2019-12-01 09:37
上一页
51
52
53
54
55
56
57
58
下一页
按字母分类:
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
其他