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
122 Largest Rectangle In Histogram solution 题解
【题目描述】Givennnon-negativeintegersrepresentingthehistogram'sbarheightwherethewidthofeachbaris1,findtheareaoflargestrectangleinthehistogram.Aboveisahistogramwherewidthofeachbaris1,givenheight=[2,1,5,6,2,
程风破浪会有时
·
2020-01-01 17:40
Lintcode
149 Best Time to Buy and Sell Stock solution 题解
【题目描述】Sayyouhaveanarrayforwhichtheithelementisthepriceofagivenstockondayi.Ifyouwereonlypermittedtocompleteatmostonetransaction(ie,buyoneandselloneshareofthestock),designanalgorithmtofindthemaximumprof
程风破浪会有时
·
2020-01-01 15:12
K Closest Points(K个最近的点)
http://www.
lintcode
.com/zh-cn/problem/k-closest-points/?rand=true/***Definitionforapoint.
天街孤独
·
2020-01-01 10:51
lintcode
转换字符串到数组
实现atoi这个函数,将一个字符串转换为整数。如果没有合法的整数,返回0。如果整数超出了32位整数的范围,返回INT_MAX(2147483647)如果是正整数,或者INT_MIN(-2147483648)如果是负整数。样例"10"=>10"-1"=>-1"123123123123123"=>2147483647"1.0"=>1这道题标的难度是困难,但其实并不难。从字符串的第一个位置开始遍历,如果
yzawyx0220
·
2020-01-01 07:04
Segment Tree Modify(线段树的修改)
http://www.
lintcode
.com/zh-cn/problem/segment-tree-modify/?
天街孤独
·
2020-01-01 06:40
132 Pattern
http://www.
lintcode
.com/zh-cn/problem/132-pattern/?
天街孤独
·
2019-12-31 12:17
Remove Node in Binary Search Tree(删除二叉查找树的节点)
http://www.
lintcode
.com/zh-cn/problem/remove-node-in-binary-search-tree/?
天街孤独
·
2019-12-31 02:11
[
LintCode
]斐波纳契数列实现及优化
前言
LintCode
是专注代码面试的在线评测系统,有很多代码题,可以用Java、C++、Python在线答题,我觉得还不错,就决定把做一做这些题,然后把题目的实现、优化思路写下来,一来是为了有更深的理解
華方
·
2019-12-31 00:09
8.Backpack II
http://www.
lintcode
.com/zh-cn/problem/backpack-ii/classSolution{public:/***@paramm:Anintegermdenotesthesizeofabackpack
Anaven
·
2019-12-30 21:45
Reverse Linked List解题报告
Description:Reversealinkedlist.Example:Forlinkedlist1->2->3,thereversedlinkedlistis3->2->1Link:http://www.
lintcode
.com
黑山老水
·
2019-12-30 20:29
Lintcode
102 Linked List Cycle solution 题解
【题目链接】www.
lintcode
.com/en/problem/linked-list-cycle/【题目解析】可以使用两个指针,一快一慢,如果有环,则这两个指针一定会相遇。
程风破浪会有时
·
2019-12-30 19:09
js刷林扣
lintcode
之二叉树的构造和前中后序遍历
66/67/68.二叉树的前/中/后序遍历【03-09】分别对应的
lintcode
地址为二叉树的前序遍历二叉树的中序遍历二叉树的后序遍历之前一直耽搁了好久没刷林扣了,用js写二叉树代码量还是不小,有的地方比较啰嗦
mytac
·
2019-12-30 17:48
LintCode
字符大小写排序
题目给定一个只包含字母的字符串,按照先小写字母后大写字母的顺序进行排序。注意事项小写字母或者大写字母他们之间不一定要保持在原始字符串中的相对位置。样例给出"abAcD",一个可能的答案为"acbAD"代码publicclassSolution{/***@paramchars:TheletterarrayyoushouldsortbyCase*@return:void*/publicvoidsort
六尺帐篷
·
2019-12-30 12:37
OJ
lintcode
两个字符串是变位词
写出一个函数anagram(s,t)判断两个字符串是否可以通过改变字母的顺序变成一样的字符串。您在真实的面试中是否遇到过这个题?Yes说明WhatisAnagram?Twostringsareanagramiftheycanbethesameafterchangetheorderofcharacters.样例给出s="abcd",t="dcab",返回true.给出s="ab",t="ab",返回
zhaozhengcoder
·
2019-12-30 07:35
LintCode
360 [Sliding Window Median]
原题给定一个包含n个整数的数组,和一个大小为k的滑动窗口,从左到右在数组中滑动这个窗口,找到数组中每个窗口内的最大值。(如果数组中有偶数,则在该窗口存储该数字后,返回第N/2-th个数字。)对于数组[1,2,7,8,5],滑动大小k=3的窗口时,返回[2,7,7]最初,窗口的数组是这样的:[1,2,7,8,5],返回中位数2;接着,窗口继续向前滑动一次。[1,2,7,8,5],返回中位数7;接着,
Jason_Yuan
·
2019-12-30 07:42
LintCode
问题图解-28
本文准备讲解1个简单的算法编程问题,这个算法编程问题来自
LintCode
平台。不了解.
LintCode
平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。
billliu_0d62
·
2019-12-30 05:02
LintCode
问题图解-15
本文准备讲解1个算法编程问题,这个算法编程问题来自
LintCode
平台。不了解.
LintCode
平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。
billliu_0d62
·
2019-12-30 00:42
LintCode
- 在二叉查找树中插入节点(普通)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:容易要求:给定一棵二叉查找树和一个新的树节点,将节点插入到树中。你需要保证该树仍然是一棵二叉查找树。22/\/\14-->14//\336思路:递归/***DefinitionofTreeNode:*publicclassTreeNode{*publicintval;*publicTreeNodeleft,right;*publicTree
柒黍
·
2019-12-29 18:49
有付出就有回报,写了三千多字的春招面试总结
从去年11月份开始,我开始有计划性地写leetcode算法题,前前后后有刷100多道题目(还有
lintcode
以及刷微博知乎遇到的题目),算是比较慢的了(解题记录和Repo)。
墨同学_imink
·
2019-12-29 18:11
LintCode
翻转字符串
题目给定一个字符串,逐个翻转字符串中的每个单词。说明单词的构成:无空格字母构成一个单词输入字符串是否包括前导或者尾随空格?可以包括,但是反转后的字符不能包括如何处理两个单词间的多个空格?在反转字符串中间空格减少到只含一个样例给出s="theskyisblue",返回"blueisskythe"分析这个较为简单,先直接用split函数将单词分割出来,然后存到list里,最后取出来依次添加并加上空格就
六尺帐篷
·
2019-12-29 17:20
[
Lintcode
]给一组整数,按照升序排序,插入排序java实现
publicclassSolution{/**@paramA:anintegerarray*@return:*/publicvoidsortIntegers(int[]A){//writeyourcodehereinttemp;for(inti=1;i0)&&(A[j]<A[j-1]);j--){temp=A[j-1];A[j-1]=A[j];A[j]=temp;}}}}
第六象限
·
2019-12-29 15:35
Lintcode
69 Binary Tree Level Order Traversal solution 题解
(ie,fromlefttoright,levelbylevel).给出一棵二叉树,返回其节点值的层次遍历(逐层从左往右访问)【题目链接】www.
lintcode
.com/en/problem/binary-tree-level-order-traversal
程风破浪会有时
·
2019-12-29 14:34
Valid Word Square
http://www.
lintcode
.com/zh-cn/problem/valid-word-square/publicclassSolution{/***@paramwords:alistofstring
天街孤独
·
2019-12-29 13:28
Walls and Gates
https://www.
lintcode
.com/zh-cn/problem/walls-and-gates/importjava.util.ArrayList;importjava.util.List
天街孤独
·
2019-12-29 08:09
LintCode
问题图解-12
本文准备讲解1个算法编程问题,这个算法编程问题来自
LintCode
平台。不了解.
LintCode
平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。
billliu_0d62
·
2019-12-29 00:08
LeetCode 208 [Implement Trie (Prefix Tree)]
样例insert("
lintcode
")search("code")#returnfalsestartsWith("lint")#returntruestartsWith("linterror")#returnfalseinsert
Jason_Yuan
·
2019-12-28 21:16
LintCode
子树
题目有两个不同大小的二进制树:T1有上百万的节点;T2有好几百的节点。请设计一种算法,判定T2是否为T1的子树。注意事项若T1中存在从节点n开始的子树与T2相同,我们称T2是T1的子树。也就是说,如果在T1节点n处将树砍断,砍断的部分将与T2完全相同。样例下面的例子中T2是T1的子树:subtree.PNG分析这道题是判断两棵树是否相等的类似问题,判断子树是否相等,本质上还是归咎于判断树是否相等,
六尺帐篷
·
2019-12-28 10:18
OJ
lintcode
克隆二叉树
深度复制一个二叉树。给定一个二叉树,返回一个他的克隆品。image.pngclassSolution{public:/***@paramroot:Therootofbinarytree*@returnrootofnewtree*/TreeNode*cloneTree(TreeNode*root){if(root!=NULL){TreeNode*q=newTreeNode();q->val=root
zhaozhengcoder
·
2019-12-28 09:23
LeetCode问题图解-6
本文准备讲解1个简单的算法编程问题,这个算法编程问题来自
LintCode
平台。不了解.
LintCode
平台的读者可以阅读笔者文章(在线编程平台推荐-LeetCode)。
billliu_0d62
·
2019-12-28 06:29
Lintcode
196 Find the Missing Number solution 题解
【题目链接】www.
lintcode
.com/en/problem/find-the-missing-number/【题目解析】最直观的思路是对数据进行排序,然后依次
程风破浪会有时
·
2019-12-28 06:58
LintCode
x的平方根
题目实现intsqrt(intx)函数,计算并返回x的平方根。样例sqrt(3)=1sqrt(4)=2sqrt(5)=2sqrt(10)=3分析这道题是典型的二分法的运用代码classSolution{/***@paramx:Aninteger*@return:Thesqrtofx*/publicintsqrt(intx){//writeyourcodehereif(x==1||x==0){ret
六尺帐篷
·
2019-12-27 23:02
LintCode
平面列表
题目给定一个列表,该列表中的每个要素要么是个列表,要么是整数。将其变成一个只包含整数的简单列表。**注意事项**如果给定的列表中的要素本身也是一个列表,那么它也可以包含列表。样例给定[1,2,[1,2]],返回[1,2,1,2]。给定[4,[3,[2,[1]]]],返回[4,3,2,1]。分析考察递归算法,显然只需要判断一下,如果得到的是个整数,直接add,如果得到的是列表,就递归这个列表代码/*
六尺帐篷
·
2019-12-27 11:41
Lintcode
388 Permutation Sequence solution 题解
【注】1≤n≤9【题目链接】www.
lintcode
.com/en/problem/permutation-sequence/【题目解析】这道题给了我们n还有k,在数列1,2,
程风破浪会有时
·
2019-12-27 10:52
Lintcode
124 Longest Consecutive Sequence solution 题解
【题目链接】www.
lintcode
.com/en/problem/longest-consecutive-sequence/【题目解析】1.对于每一个n,检查是否为一个
程风破浪会有时
·
2019-12-27 09:41
Lintcode
39 Recover Rotated Sorted Array solution 题解
【题目链接】http://www.
lintcode
.com/en/problem/recover-rotated-sorted-array/【题目解析】首先可以想到逐步移位,但是这种方法显然太浪费时间,
代码码着玩
·
2019-12-27 03:33
One-liner JS debug-logger for recursive function coding exercise
Codingexerciselikeleetcode,
lintcode
,hackerrankarejustgymroomsforprogrammers.Butdebugyourcodeonyourwebpagecanbehorrible.Thisiseventruewhenyouwriterecursivefunctions
Star_C
·
2019-12-27 00:05
Lintcode
499 Word Count (Map Reduce) solution 题解
mapreduce来计算单词频率https://hadoop.apache.org/docs/r1.2.1/mapred_tutorial.html#Example%3A+WordCount+v1【题目链接】www.
lintcode
.com
程风破浪会有时
·
2019-12-26 23:10
Lintcode
424 Evaluate Reverse Polish Notation solution 题解
【题目描述】EvaluatethevalueofanarithmeticexpressioninReversePolishNotation.Validoperatorsare+,-,*,/.Eachoperandmaybeanintegeroranotherexpression.求逆波兰表达式的值。在逆波兰表达法中,其有效的运算符号包括+,-,*,/。每个运算对象可以是整数,也可以是另一个逆波兰计
程风破浪会有时
·
2019-12-26 04:38
单调栈 Summary (Leetcode 456, Leetcode 84,
Lintcode
122)
单调栈的用法是:用来找数组,左边或右边,第一个比当前元素小(或者大)的是谁。即insert前,栈顶的元素。一个递增的单调栈如下:递减的也可以相应实现。for(inti=0;i=nums[i]){st.pop();}}同时,一个重要的变形是单调栈可以用deque实现,来找比当前元素小的最小元素。单调栈相对灵活,对元素的处理可以在pop的时候,或者在whileloop以外,即push之前。一个基本的框
stepsma
·
2019-12-25 23:14
Lintcode
4 Ugly Number II solution 题解
【题目描述】Uglynumberisanumberthatonlyhavefactors2,3and5.Designanalgorithmtofindthenthuglynumber.Thefirst10uglynumbersare1,2,3,4,5,6,8,9,10,12...Notice:Notethat1istypicallytreatedasanuglynumber.设计一个算法,找出只含
代码码着玩
·
2019-12-25 15:28
LintCode
插入区间
题目给出一个无重叠的按照区间起始端点排序的区间列表。在列表中插入一个新的区间,你要确保列表中的区间仍然有序且不重叠(如果有必要的话,可以合并区间)。样例插入区间[2,5]到[[1,2],[5,9]],我们得到[[1,9]]。插入区间[3,4]到[[1,2],[5,9]],我们得到**[[1,2],[3,4],[5,9]]**。分析总共插入就三种情况,一种插到中间一种插到最前面一种插到最后面代码/*
六尺帐篷
·
2019-12-25 01:54
LintCode
-68.二叉树的后序遍历
题目描述给出一棵二叉树,返回其后序遍历样例给出二叉树{1,#,2,3},1\2/3返回[3,2,1].解答思路后序遍历二叉树代码/***DefinitionofTreeNode:*publicclassTreeNode{*publicintval;*publicTreeNodeleft,right;*publicTreeNode(intval){*this.val=val;*this.left=t
悠扬前奏
·
2019-12-24 14:50
LintCode
- 子数组之和(普通)
版权声明:本文为博主原创文章,未经博主允许不得转载。难度:容易要求:给定一个整数数组,找到和为零的子数组。你的代码应该返回满足要求的子数组的起始位置和结束位置样例给出[-3,1,2,-3,4],返回[0,2]或者[1,3].思路:/***@paramnums:Alistofintegers*@return:Alistofintegersincludestheindexofthefirstnumbe
柒黍
·
2019-12-24 10:19
Reverse Order Storage
http://www.
lintcode
.com/zh-cn/problem/reverse-order-storage/importjava.util.ArrayList;importjava.util.List
天街孤独
·
2019-12-24 10:02
LintCode
156-合并区间
分析注意细节处理就好/***DefinitionofInterval:*classInterval{*intstart,end;*Interval(intstart,intend){*this->start=start;*this->end=end;*}*/classSolution{public:/***@paramintervals:intervallist.*@return:Anewinte
胡哈哈哈
·
2019-12-24 00:36
Lintcode
33 N-Queens solution 题解
【题目描述】Then-queenspuzzleistheproblemofplacingnqueensonann×nchessboardsuchthatnotwoqueensattackeachother.Givenanintegern,returnalldistinctsolutionstothen-queenspuzzle.Eachsolutioncontainsadistinctboardc
代码码着玩
·
2019-12-23 16:26
Lintcode
70 Binary Tree Level Order Traversal II solution 题解
fromlefttoright,levelbylevelfromleaftoroot).给出一棵二叉树,返回其节点值从底向上的层次序遍历(按从叶节点所在层到根节点所在的层遍历,然后逐层从左往右遍历)【题目链接】www.
lintcode
程风破浪会有时
·
2019-12-23 14:10
LintCode
77. Longest Common Subsequence 最长公共序列
题目链接Description Giventwostrings,findthelongestcommonsubsequence(LCS).YourcodeshouldreturnthelengthofLCS.Example1:Input:"ABCD"and"EDCA"Output:1Explanation:LCSis'A'or'D'or'C'Example2:Input:"ABCD"and"EA
xingzai
·
2019-12-23 10:08
斐波那契数列的递归与尾递归
引言之前在
lintcode
上刷算法入门题,366题是求斐波那契数列,当时就想用递归应该很快就ac了,最后递归是没写错,但是提交报时间超限了,也就引出了这篇文章——尾递归。
Walkerc
·
2019-12-23 09:44
OJ
lintcode
Fizz Buzz 问题
给你一个整数n.从1到n按照下面的规则打印每个数:如果这个数被3整除,打印fizz.如果这个数被5整除,打印buzz.如果这个数能同时被3和5整除,打印fizzbuzz.image.pngclassSolution{public:/***paramn:Asdescription.*return:Alistofstrings.*/vectorfizzBuzz(intn){vectorresults;
zhaozhengcoder
·
2019-12-23 09:43
上一页
49
50
51
52
53
54
55
56
下一页
按字母分类:
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
其他