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
LeetCode题
LeetCode题
解系列之二叉搜索树
二叉搜索树广告:最近github上新开了一个仓库May-Nodes,包括但不限于之前面试遇到的相关数据库,计算机操作系统,Java基础知识,计算机网络以及LeetCode等算法题解等知识。届时也会整理学习使用的PDF文档与资源。有需要的小伙伴可以点个关注和star。在持续更新中,总会遇到你想要的。前言首先明白二叉搜索树系列的特殊性:二叉搜索树(BinarySearchTree简称为BST),对于其
maycope
·
2020-08-21 03:20
leetcode
golang链表理解、递归
1、不使用递归a.链表间运算(逐位相加)
leetcode题
目示例:输入:(2->4->3)+(5->6->4)输出:7->0->8原因:342+465=807/***Definitionforsingly-linkedlist
沧浪水
·
2020-08-20 23:23
golang
链表
golang链表理解、递归
1、不使用递归a.链表间运算(逐位相加)
leetcode题
目示例:输入:(2->4->3)+(5->6->4)输出:7->0->8原因:342+465=807/***Definitionforsingly-linkedlist
沧浪水
·
2020-08-20 23:23
golang
链表
Stack类详解
前言今天在做
leetcode题
目时,用到了栈Stack类,之前没有接触过,所以学习下Stack继承关系Stack继承了Vertor,所以他本质上是个数组,和集合类密不可分Stack类:只有一个无参构造函数
leo_messi94
·
2020-08-20 19:40
JDK常用类
Leetcode 560.和为K的子数组(Subarray Sum Equals K)
Leetcode560.和为K的子数组1题目描述(
Leetcode题
目链接) 给定一个整数数组和一个整数k,你需要找到该数组中和为k的连续的子数组的个数。
就叫昵称吧
·
2020-08-20 17:18
Leetcode
LeetCode题
解-110-Balanced Binary Tree
原题原题链接:https://leetcode.com/problems/balanced-binary-tree/这个题目有一个很大的争议就是AVL的定义,我以为的AVL的定义一直是“no2leafnodesdifferindistancefromtherootbymorethan1”,与这个题目不同,所以一开始提交了错误的方法,但是查阅了资料发现LeetCode给出的定义应该才是正确的定义,请
WangT443
·
2020-08-20 15:00
LeetCode
lc207 course schedule
leetcode题
目点链接可以看到。我记得这学期算法课期中考试也考到了拓扑排序,可惜那时候我刚转cs对算法的boundary不熟悉,题目简单的变了点花样(描述)我就没认出来其实就是拓扑排序。
aureole420
·
2020-08-20 08:24
LeetCode题
目:String to Integer (atoi)
Implementatoitoconvertastringtoaninteger.Hint:Carefullyconsiderallpossibleinputcases.Ifyouwantachallenge,pleasedonotseebelowandaskyourselfwhatarethepossibleinputcases.Notes:Itisintendedforthisproblemt
sparklebobo
·
2020-08-20 06:45
学习日志
关于求中位数Median的相关
LeetCode题
目
关于我的
Leetcode题
目解答,代码前往Github:https://github.com/chenxiangcyr/leetcode-answers如何理解中位数Median:Dividingasetintotwoequallengthsubsets
专职跑龙套
·
2020-08-20 06:18
LeetCode题
解(python)-27. 移除元素
LeetCode题
解(python)27.移除元素题目描述给定一个数组nums和一个值val,你需要原地移除所有数值等于val的元素,返回移除后数组的新长度。
Marshal Zheng
·
2020-08-20 04:40
算法
LeetCode题解
Python学习日记——移除元素
Python学习日记007——移除元素题目来源:
LeetCode题
库——移除元素给你一个数组nums和一个值val,你需要原地移除所有数值等于val的元素,并返回移除后数组的新长度。
black° �
·
2020-08-20 04:18
LeetCode题
解-Go 0x0000
搭建单元测试框架以two-sum为例,第一个输入参数是int数组,第二个输入参数是int,输出结果是int数组。在Go中定义如下结构对应本题的输入、输出数据。给定一个整数数组nums 和一个目标值target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。示例:给定nums=[2,7,11,15],
weixin_34227447
·
2020-08-20 04:08
leetcode题
:27. 移除元素(简单)
一、题目描述:27.移除元素(简单)给定一个数组nums和一个值val,你需要原地移除所有数值等于val的元素,返回移除后数组的新长度。不要使用额外的数组空间,你必须在原地修改输入数组并在使用O(1)额外空间的条件下完成。元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。示例1:给定nums=[3,2,2,3],val=3,函数应该返回新的长度2,并且nums中的前两个元素均为2。你不需
tankpanv
·
2020-08-20 04:42
leetcode
leetcode刷题——双指针(快慢指针)
包含几道
leetcode题
目:141判断列表是否存在环(easy)283移动零(easy)27移除元素(easy)26删除排序数组中的重复项(easy)80删除排序数组中的重复项II(medium)141
lxztju
·
2020-08-20 03:43
leetcode刷题
leetcode题
解-143. Reorder List
题目GivenasinglylinkedlistL:L0→L1→…→Ln-1→Ln,reorderitto:L0→Ln→L1→Ln-1→L2→Ln-2→…Youmustdothisin-placewithoutalteringthenodes'values.Forexample,Given{1,2,3,4},reorderitto{1,4,2,3}.本题的目的是实现链表的重排,将最后一个元素插在第
liuchongee
·
2020-08-20 03:34
leetcode刷题
LeetCode题
解 -- 字符串和数组(1371)
FindtheLongestSubstringContainingVowelsinEvenCountsGiventhestrings,returnthesizeofthelongestsubstringcontainingeachvowelanevennumberoftimes.Thatis,‘a’,‘e’,‘i’,‘o’,and‘u’mustappearanevennumberoftimes.相
fantow
·
2020-08-20 03:12
字符串和数组
LeetCode题
解 -- 双指针(325)
MaximumSizeSubarraySumEqualsk最大子数组之和为kGivenanarraynumsandatargetvaluek,findthemaximumlengthofasubarraythatsumstok.Ifthereisn’tone,return0instead.Givennums=[1,-1,5,-2,3],k=3,return4.(becausethesubarray
fantow
·
2020-08-20 03:12
#双指针
LeetCode题
解 -- 字符串和数组(560)
SubarraySumEqualsKGivenanarrayofintegersandanintegerk,youneedtofindthetotalnumberofcontinuoussubarrayswhosesumequalstok.方法一:Presum时间复杂度:O(n^2)空间复杂度:O(n)publicintsubarraySum(int[]nums,intk){intlength=n
fantow
·
2020-08-20 03:12
字符串和数组
LeetCode题
解 -- 双指针(80)
RemoveDuplicatesfromSortedArrayIIGivenasortedarraynums,removetheduplicatesin-placesuchthatduplicatesappearedatmosttwiceandreturnthenewlength.Donotallocateextraspaceforanotherarray,youmustdothisbymodif
fantow
·
2020-08-20 03:12
#双指针
将二叉树拆成链表
LeetCode题
目地址defflatten(self,root):#writeyourcodehereifroot==None:returnroot#用根节点初始化栈#然后出栈一个,就入栈右孩子,左孩子出
只为此心无垠
·
2020-08-20 03:53
4. 寻找两个有序数组的中位数
题目描述请点击查看
LeetCode题
目描述Python3代码解答如下:classSolution:deffindMedianSortedArrays(self,nums1,nums2):""":typenums1
勿问情殇
·
2020-08-20 03:38
LeetCode
LeetCode题库之解答
LeetCode题
解(Java实现)——27. Remove Element(删除数组中指定元素)
前言欢迎关注我的Github,如果觉得有帮助,请点个star哟,目前主要在更
leetcode题
解(Java版)和剑指offer题解(Java版),可以点个star。
樱木天亥
·
2020-08-20 03:57
Java
leetcode
高频考题!数组中找重复数字(算法 NO.1)
项目地址:https://github.com/doocs/
leetcode题
目描述找出数组中重复的数字。在一个长度为n的数组nums里的所有数字都在0~n-1的范围内。
傲雪滨锋
·
2020-08-20 02:17
LeetCode题
解 -- 双指针(27)
RemoveElementGivenanarraynumsandavalueval,removeallinstancesofthatvaluein-placeandreturnthenewlength.Donotallocateextraspaceforanotherarray,youmustdothisbymodifyingtheinputarrayin-placewithO(1)extrame
fantow
·
2020-08-20 02:26
#双指针
python数据结构实现(七):回溯、分治和动态规划及相关
LeetCode题
python数据结构实现(七)1回溯1.1python利用回溯算法求解八皇后问题1.2python利用回溯算法求解0-1背包问题2分治2.1python利用分治算法求一组数据的逆序对个数3动态规划3.1python利用动态规划求解0-1背包问题3.2python实现求解最小路径和3.3python实现莱文斯坦最短编辑距离3.4python实现查找两个字符串的最长公共子序列3.5python实现一个
Andrewings
·
2020-08-20 01:40
数据结构
原来状态机也可以用来刷LeetCode?
LeetCode题
目地址:https://leetcode-cn.com/problems/greatest-sum-divisible-by-three/description/题目描述暴力法思路一种方式是找出所有的能够被
fe_lucifer
·
2020-08-19 23:56
每日一道 LeetCode (21):对称二叉树
前文合集每日一道LeetCode前文合集代码仓库GitHub:https://github.com/meteor1993/LeetCodeGitee:https://gitee.com/inwsy/
LeetCode
极客挖掘机
·
2020-08-19 18:04
LeetCode
[LeetCode] 030. Substring with Concatenation of All Words (Hard) (C++/Java)
索引:[LeetCode]
Leetcode题
解索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode030.SubstringwithConcatenationofAllWords
hcbbt
·
2020-08-19 17:41
=====算法相关=====
+Leetcode
+基础算法
Leetcode
题解
Leetcode题
解---杂题
目录49.字母异位词分组55.跳跃游戏56.合并区间75.颜色分类78.子集90.子集II128.最长连续序列136.只出现一次的数字139.单词拆分146.LRU缓存机制155.最小栈169.多数元素887.鸡蛋掉落具体如下:49.字母异位词分组classSolution:defgroupAnagrams(self,strs:List[str])->List[List[str]]:dict={}
子季鹰才
·
2020-08-19 16:08
Leetcode题
解之数组
完美的数组逆置算法整型数组的逆置算法最简单的首尾互换:合理利用泛型封装类型与基本类型的各自适用范围旋转数组Leetcode189.RotateArray三步反转法:和为s的两个数字和为s的连续正整数序列思路:利用双指针start,end;当前s数列和为sum,如果当前数列和小于s那么end++,如果大于s,那么start++,如果等于则输出start到end,当start=(s+1)/2时退出循环
Handsome_Sheep
·
2020-08-19 10:24
LeetCode题
解:Island Perimeter
Youaregivenamapinformofatwo-dimensionalintegergridwhere1representslandand0representswater.Gridcellsareconnectedhorizontally/vertically(notdiagonally).Thegridiscompletelysurroundedbywater,andthereisexa
MagiSu
·
2020-08-19 08:35
C/C++
数据结构和算法
LeetCode题
解(0020):有效的括号(Python)
题目:题目链接(简单)标签:栈、字符串解法时间复杂度空间复杂度执行用时Ans1(Python)O(N)O(N)O(N)O(N)O(N)O(N)36ms(89.92%)Ans2(Python)O(N)O(N)O(N)O(N)O(N)O(N)36ms(89.92%)Ans3(Python)O(N2)O(N^2)O(N2)O(N)O(N)O(N)52ms(20.39%)解法一(使用列表存储当前括号状态)
长行
·
2020-08-19 07:38
LeetCode题解
数组水题合集——
LeetCode题
海实战汇总
目录LeetCode1295.统计位数为偶数的数字LeetCode1252.奇数值单元格的数组LeetCode1304.和为零的N个唯一整数LeetCode1299.将每个元素替换为右侧最大元素LeetCode26.删除排序数组中的重复项LeetCode面试题16.01.交换数字LeetCode1313.解压缩编码列表LeetCode1351.统计有序矩阵中的负数LeetCode面试题01.07.
沉迷单车的追风少年
·
2020-08-19 07:13
LeetCode
算法—STL与数据结构
LeetCode经典
LeetCodet题解--20. Valid Parentheses(括号匹配问题)
链接
LeetCode题
目:https://leetcode.com/problems/valid-parentheses/GitHub代码:https://github.com/gatieme/LeetCode
JeanCheng
·
2020-08-19 06:00
┈┈【LeetCode
面试题】
深度学习|反向传播算法(BP)原理推导及代码实现
包含但不限于:经典算法,机器学习,深度学习,
LeetCode题
解,Kaggle实战。期待您的到来!
算法channel
·
2020-08-19 06:26
LeetCode题
集整理- 贪心算法
1、贪心算法简介贪心算法(又称贪婪算法)是指,在对问题求解时,总是做出在当前看来是最好的选择。也就是说,不从整体最优上加以考虑,他所做出的是在某种意义上的局部最优解。贪心算法不是对所有问题都能得到整体最优解,关键是贪心策略的选择,选择的贪心策略必须具备无后效性,即某个状态以前的过程不会影响以后的状态,只与当前状态有关。举例说明1:对于人民币的面值有1元5元10元20元50元100元,下面要求设计一
AKyS佐毅
·
2020-08-19 03:03
【图】拓扑排序(DFS和BFS解法)
拓扑排序
LeetCode题
目:210.CourseScheduleII题目链接:https://leetcode.com/problems/course-schedule-ii/description/
菜鸡也想写代码
·
2020-08-19 03:10
算法
leetcode题
库01两数相加
点击题目原文给定一个整数数组和一个目标值,找出数组中和为目标值的两个数。你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用。示例:给定nums=[2,7,11,15],target=9因为nums[0]+nums[1]=2+7=9所以返回[0,1]这个很简单,可以直接两重循环解决,但是,这样做的时间复杂度为O(n²).如果使用HashMap可以让时间复杂度降低为O(n).数组中的inde
alphascott
·
2020-08-19 01:50
Leetcode95 不同的二叉搜索树Ⅱ
:https://leetcode-cn.com/problems/unique-binary-search-trees-ii/博主Github:https://github.com/GDUT-Rp/
LeetCode
Rp_
·
2020-08-18 23:29
Leetcode
LeetCode题
解——分治算法
文章目录241.为运算表达式设计优先级分治算法95.不同的二叉搜索树II241.为运算表达式设计优先级给定一个含有数字和运算符的字符串,为表达式添加括号,改变其运算优先级以求出不同的结果。你需要给出所有可能的组合的结果。有效的运算符号包含+,-以及*。示例1:输入:"2-1-1"输出:[0,2]解释:((2-1)-1)=0(2-(1-1))=2示例2:输入:"2*3-4*5"输出:[-34,-14
wardseptember
·
2020-08-18 22:36
LeetCode题解
leetcode题
解日练--2016.6.26
编程日记,尽量保证每天至少3道
leetcode题
,仅此记录学习的一些题目答案与思路,尽量用多种思路来分析解决问题,不足之处还望指出。标红题为之后还需要再看的题目。
steve_99
·
2020-08-18 22:14
leetcode
leetcode
编程
日记
LeetCode2. 小张刷题计划
1.题目为了提高自己的代码能力,小张制定了LeetCode刷题计划,他选中了
LeetCode题
库中的n道题,编号从0到n-1,并计划在m天内按照题目编号顺序刷完所有的题目(注意,小张不能用多天完成同一题
rosefunR
·
2020-08-18 21:44
LeetCode
leetcode题
解——53. Maximum Subarray
题目的意思就是:在给定的数组中选取一组连续的子数组,使得这个子数组的和是所有子数组和最大值。解法一(分治策略)思路:我首先想到的是算法导论分治策略一章给出的解法:假设我们要寻找数组A[left,right]中的最大子数组,分治策略要求我们把问题分解两个规模相当的子数组,也就是说要找的子数组的中心middle,然后考虑求解两个子数组A1[left,middle],A2[middle+1,right]
GeneralSandman
·
2020-08-18 21:53
leetcode
leetcode题
解-160. Intersection of Two Linked Lists
题目:Writeaprogramtofindthenodeatwhichtheintersectionoftwosinglylinkedlistsbegins.Forexample,thefollowingtwolinkedlists:A:a1→a2↘c1→c2→c3↗B:b1→b2→b3begintointersectatnodec1.Notes:Ifthetwolinkedlistshaven
liuchongee
·
2020-08-18 20:25
leetcode刷题
leetcode 145 二叉树的后序遍历 Binary Tree Postorder Traversal python (迭代、递归)
所有
Leetcode题
目不定期汇总在Github,欢迎大家批评指正,讨论交流。'''
每一个有风的日子
·
2020-08-18 20:53
【leetcode】
刷题总结
&
编程心得
[LeetCode] 002. Add Two Numbers (Medium) (C++/Java/Python)
索引:[LeetCode]
Leetcode题
解索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode002.Add_Two_Numbers
hcbbt
·
2020-08-18 20:05
+Leetcode
=====算法相关=====
+基础算法
Leetcode
题解
[LeetCode] 001. Two Sum (Medium) (C++/Java/Python)
索引:[LeetCode]
Leetcode题
解索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode001.Two_Sum(Medium
hcbbt
·
2020-08-18 20:05
+基础算法
+Leetcode
=====算法相关=====
Leetcode
题解
LeetCode题
解:Merge/Insert Interval
MergeIntervalsGivenacollectionofintervals,mergealloverlappingintervals.Forexample,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].InsertIntervalGivenasetofnon-overlappingintervals,insertane
MagiSu
·
2020-08-18 19:40
数据结构和算法
LeetCode题
解:Add Two Numbers
AddTwoNumbersYouaregiventwolinkedlistsrepresentingtwonon-negativenumbers.Thedigitsarestoredinreverseorderandeachoftheirnodescontainasingledigit.Addthetwonumbersandreturnitasalinkedlist.Input:(2->4->3)
MagiSu
·
2020-08-18 19:40
数据结构和算法
leetcode题
解-2. Add Two Numbers
题意:给你两个表示两个非负数字的链表。数字以相反的顺序存储,其节点包含单个数字。将这两个数字相加并将其作为一个链表返回。例子:输入:(2->4->3)+(5->6->4)输出:7->0->8解释:342+465=807.分析:这道题比较简单,两个链表相加的问题,思路很明确,就是按照位数读下去,维护当前位和进位,时间复杂度是O(n),空间复杂度是O(1).另外本题是链表部分的第一题,所以也附上链表部
北邮张博
·
2020-08-18 19:49
Leetcode题解
上一页
34
35
36
37
38
39
40
41
下一页
按字母分类:
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
其他