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题
解——双指针(一)
文章目录167.两数之和II-输入有序数组二分查找双指针633.平方数之和双指针345.反转字符串中的元音字母双指针双指针优化680.验证回文字符串Ⅱ双指针167.两数之和II-输入有序数组给定一个已按照升序排列的有序数组,找到两个数使得它们相加之和等于目标数。函数应该返回这两个下标值index1和index2,其中index1必须小于index2。说明:返回的下标值(index1和index2)
wardseptember
·
2020-08-18 19:54
LeetCode题解
LeetCode题
解——Minimum Window Substring
GivenastringSandastringT,findtheminimumwindowinSwhichwillcontainallthecharactersinTincomplexityO(n).Forexample,S="ADOBECODEBANC"T="ABC"Minimumwindowis"BANC".Note:IfthereisnosuchwindowinSthatcoversallc
susandebug
·
2020-08-18 19:45
LeetCode
LeetCode题
解——Sliding Window Maximum
Givenanarraynums,thereisaslidingwindowofsizekwhichismovingfromtheveryleftofthearraytotheveryright.Youcanonlyseetheknumbersinthewindow.Eachtimetheslidingwindowmovesrightbyoneposition.Forexample,Givennu
susandebug
·
2020-08-18 19:45
LeetCode
LeetCode题
解——最大公约数
题目描述:如何求出最大公约数?解法一:暴力枚举法:时间复杂度是O(min(a,b))。1.publicstaticintgetGreatestCommonDivisor(inta,intb){2.intbig=a>b?a:b;3.intsmall=a1;i--){8.if(small%i==0&&big%i==0){9.returni;10.}11.}12.return1;13.}14.14.pu
HUSTER593
·
2020-08-18 19:57
C++
LeetCode题
解——401. 二进制手表
题目相关题目链接LeetCode中国,https://leetcode-cn.com/problems/binary-watch/。注意需要登录。题目描述二进制手表顶部有4个LED代表小时(0-11),底部的6个LED代表分钟(0-59)。每个LED代表一个0或1,最低位在右侧。例如,上面的二进制手表读取“3:25”。给定一个非负整数n代表当前LED亮着的数量,返回所有可能的时间。示例输入:n=1
努力的老周
·
2020-08-18 19:09
OJ题解
#
LeetCode题解
#
回溯算法
LeetCode题
解——22. 括号生成
题目相关题目链接LeetCode中国,https://leetcode-cn.com/problems/generate-parentheses/。LeetCode中国,https://leetcode-cn.com/problems/bracket-lcci/。两题是一样的。题目描述括号。设计一种算法,打印n对括号的所有合法的(例如,开闭一一对应)组合。说明:解集不能包含重复的子集。示例例如,给
努力的老周
·
2020-08-18 19:09
OJ题解
#
LeetCode题解
#
回溯算法
leetcode 144 Binary Tree Preorder Traversal 二叉树的前序遍历 python(递归、迭代)
所有
Leetcode题
目不定期汇总在Github,欢迎大家批评指正,讨论交流。'''
每一个有风的日子
·
2020-08-18 19:00
【leetcode】
刷题总结
&
编程心得
Leetcode题
解——算法思想之分治
1.给表达式加括号2.不同的二叉搜索树1.给表达式加括号241.DifferentWaystoAddParentheses(Medium)Input:"2-1-1".((2-1)-1)=0(2-(1-1))=2Output:[0,2]publicListdiffWaysToCompute(Stringinput){Listways=newArrayListleft=diffWaysToComput
dieshi8689
·
2020-08-18 19:49
LeetCode题
解 —— 2. Add Two Numbers
题目内容:Difficulty:MediumTotalAccepted:442.7KTotalSubmissions:1.6MYouaregiventwonon-emptylinkedlistsrepresentingtwonon-negativeintegers.Thedigitsarestoredinreverseorderandeachoftheirnodescontainasingledi
IT_xiao_bai
·
2020-08-18 18:26
java
LeetCode
LeetCode题
解——树(四)
文章目录BST将有序数组转换为二叉搜索树递归有序链表转换二叉搜索树递归中序遍历两数之和IV-输入BST中序遍历二叉搜索树的最小绝对差中序遍历中序遍历优化二叉搜索树中的众数中序遍历Morris中序遍历字典树实现Trie(前缀树)解法键值映射解法推荐阅读BST将有序数组转换为二叉搜索树将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。本题中,一个高度平衡二叉树是指一个二叉树每个节点的左右两个
wardseptember
·
2020-08-18 18:42
LeetCode题解
面试题30:包含min函数的栈
包含min函数的栈题目描述
leetcode题
目描述定义栈的数据结构,请在该类型中实现一个能够得到栈的最小元素的min函数。
我的喵喵找不到了
·
2020-08-18 16:43
C++
leetcode
算法
LeetCode题
解(0214):通过在字符串前添加字符成为回文串的最短回文串(Python)
题目:原题链接(困难)标签:字符串、双指针、递归、KMP算法解法时间复杂度空间复杂度执行用时Ans1(Python)O(N2)O(N^2)O(N2)O(N)O(N)O(N)464ms(23.10%)Ans2(Python)O(N2)O(N^2)O(N2)O(N)O(N)O(N)44ms(98.78%)Ans3(Python)O(N)O(N)O(N)O(N)O(N)O(N)56ms(92.39%)这
长行
·
2020-08-18 13:54
LeetCode题解
leetcode
python
字符串
递归
KMP算法
每日一道 LeetCode (20):相同的树
前文合集每日一道LeetCode前文合集代码仓库GitHub:https://github.com/meteor1993/LeetCodeGitee:https://gitee.com/inwsy/
LeetCode
极客挖掘机
·
2020-08-18 13:59
LeetCode
每日一道 LeetCode (21):对称二叉树
前文合集每日一道LeetCode前文合集代码仓库GitHub:https://github.com/meteor1993/LeetCodeGitee:https://gitee.com/inwsy/
LeetCode
极客挖掘机
·
2020-08-18 08:00
【
LeetCode题
解---1】Two Sum.md
【
LeetCode题
解—1】TwoSum题目Givenanarrayofintegers,returnindicesofthetwonumberssuchthattheyadduptoaspecifictarget.Youmayassumethateachinputwouldhaveexactlyonesolution
程序猿杂货铺
·
2020-08-18 08:29
LeetCode
LeetCode 45. Jump Game II--Python解法--动态规划
LeetCode45.JumpGameII–Python解法–动态规划
LeetCode题
解专栏:
LeetCode题
解LeetCode所有题目总结:LeetCode所有题目总结大部分题目C++,Python
zhang0peter
·
2020-08-18 07:23
LeetCode
python-做题
树的“最近公共祖先”问题,面试不再怕了!
项目地址:https://github.com/doocs/
leetcode题
目1题目描述二叉树的最近公共祖先。给定一个二叉树,找到该树中两个指定节点的最近公共祖先。百度百科中最近公
傲雪滨锋
·
2020-08-18 07:09
算法
二叉树
百度
streaming
比特币
Leetcode题
目55. 跳跃游戏
题目描述给定一个非负整数数组,你最初位于数组的第一个位置。数组中的每个元素代表你在该位置可以跳跃的最大长度。判断你是否能够到达最后一个位置。示例:输入:[2,3,1,1,4]输出:true解释:我们可以先跳1步,从位置0到达位置1,然后再从位置1跳3步到达最后一个位置。python代码classSolution:defcanJump(self,nums):max_i=nums[0]#初始化当前能到
海里的羊
·
2020-08-18 05:18
leetcode
Leetcode174 地下城游戏 C++,Java,Python
LeetCode)链接:https://leetcode-cn.com/problems/dungeon-game/submissions/博主Github:https://github.com/GDUT-Rp/
LeetCode
Rp_
·
2020-08-18 05:02
Leetcode
面试题 16.19.水域大小
示例:输入:[[0,2,1,0],[0,1,0,1],[1,1,0,1],[0,1,0,1]]输出:[1,2,4]来源:力扣(
LeetCode题
目很正常,思路也
WKP9418
·
2020-08-18 01:33
力扣
Leetcode 1436.旅行终点站(Destination City)
Leetcode1436.旅行终点站1题目描述(
Leetcode题
目链接) 给你一份旅游线路图,该线路图中的旅行线路用数组paths表示,其中paths[i]=[cityAi,cityBi]表示该线路将会从
就叫昵称吧
·
2020-08-18 01:21
Leetcode
Leetcode 1342.将数字变成 0 的操作次数(Number of Steps to Reduce a Number to Zero)
Leetcode1342.将数字变成0的操作次数1题目描述(
Leetcode题
目链接) 给你一个非负整数num,请你返回将它变成0所需要的步数。如果当前数字是偶数,你需要把它除以2;否则,减去1。
就叫昵称吧
·
2020-08-18 01:21
Leetcode
Leetcode刷题笔记系列——持续更新中
前言此博文是博主在刷完400多道
leetcode题
目后开始总结的,因为刷完题目后会很快就忘记,即使遇见相同或类似的仍然无法AC,在此打算将不同类型的题目进行总结,并尽量总结出模板,本系列是按照每日一题,
Jackybored
·
2020-08-18 00:28
Leetode刷题系列
C++算法:最大回文子串---动态规划-----夹逼法----中心扩展法
leetcode相关C++算法解答:https://github.com/Nereus-Minos/C_plus_plus-
leetcode题
目:给定一个字符串s,找到s中最长的回文子串。
Zeus_dad
·
2020-08-18 00:22
C++算法
LeetCode题
库第十四题(简单系列)
题目及要求:编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串""。示例1:输入:["flower","flow","flight"]输出:"fl"示例2:输入:["dog","racecar","car"]输出:""解释:输入不存在公共前缀。说明:所有输入只包含小写字母a-z。思路:看到题目的时候,第一想法是要用需要用到列表的切片,而且肯定是要遍历切片的,但是怎么求得
nodoself
·
2020-08-18 00:17
LeetCode简单系列
Leetcode题库练习
leetcode-python 第一周
LeetCodeOnlineJudgehttps://leetcode.com/
LeetCode题
解https://github.com/soulmachine/leetcode1.TwoSum[2968ms
Viggo_yuan
·
2020-08-17 23:54
LeetCode
LeetCode题
解——64. 最小路径和
题目相关题目链接LeetCode中国,https://leetcode-cn.com/problems/minimum-path-sum/。题目描述给定一个包含非负整数的mxn网格,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。说明:每次只能向下或者向右移动一步。示例输入:[[1,3,1],[1,5,1],[4,2,1]]输出:7解释:因为路径1→3→1→1→1的总和最小。题目分析
努力的老周
·
2020-08-17 23:38
OJ题解
#
LeetCode题解
#
动态规划
leetcode 279 完全平方数(Perfect Squares) python BFS,四平方定理
所有
Leetcode题
目不定期汇总在Github,欢迎大家批评指正,讨论交流。'''
每一个有风的日子
·
2020-08-17 22:28
【leetcode】
刷题总结
&
编程心得
leetcode 877 Stone Game 石子游戏 python 动规
所有
Leetcode题
目不定期汇总在Github,欢迎大家批评指正,讨论交流。
每一个有风的日子
·
2020-08-17 22:28
【leetcode】
刷题总结
&
编程心得
leetcode 14 最长公共前缀(Longest common prefix) python3 多种思路(sorted() / sort())
所有
Leetcode题
目不定期汇总在Github,欢迎大家批评指正,讨论交流。
每一个有风的日子
·
2020-08-17 22:28
【leetcode】
刷题总结
&
编程心得
leetcode题
解:1306. 跳跃游戏 III-DFS
leetcode题
解:1306.跳跃游戏III题目这里有一个非负整数数组arr,你最开始位于该数组的起始下标start处。当你位于下标i处时,你可以跳到i+arr[i]或者i-arr[i]。
g_curry
·
2020-08-17 22:36
leetcode
【LeetCode】452. Minimum Number of Arrows to Burst Balloons 解题报告(Python)
【LeetCode】452.MinimumNumberofArrowstoBurstBalloons解题报告(Python)标签(空格分隔):
LeetCode题
目地址:https://leetcode.com
负雪明烛
·
2020-08-17 22:32
算法
LeetCode
[
LeetCode题
解]55.Jump Game
Givenanarrayofnon-negativeintegers,youareinitiallypositionedatthefirstindexofthearray.Eachelementinthearrayrepresentsyourmaximumjumplengthatthatposition.Determineifyouareabletoreachthelastindex.此题使用贪心
duxin5
·
2020-08-17 22:34
leetcode
Jump Game II 解法
JumpGameII解法第18周题目难度:Hard
LeetCode题
号:45题目Description:Givenanarrayofnon-negativeintegers,youareinitiallypositionedatthefirstindexofthearray.Eachelementinthearrayrepresentsyourmaximumjumplengthatthatposi
chenh297
·
2020-08-17 21:55
算法题
14. 最长公共前缀
题目描述请点击查看
LeetCode题
目描述Python3代码解答如下:classSolution:deflongestCommonPrefix(self,strs):""":typestrs:List[
勿问情殇
·
2020-08-17 21:17
LeetCode
LeetCode题库之解答
【
leetcode题
解】leetcode 1024 Video Stitching
【传送门】https://leetcode.com/problems/video-stitching/【原题描述】1024.VideoStitchingMedium196FavoriteShareYouaregivenaseriesofvideoclipsfromasportingeventthatlastedTseconds.Thesevideoclipscanbeoverlappingwith
空壳789
·
2020-08-17 21:40
leetcode题
目 跳跃游戏系列题目
题目一:Givenanarrayofnon-negativeintegers,youareinitiallypositionedatthefirstindexofthearray.Eachelementinthearrayrepresentsyourmaximumjumplengthatthatposition.Yourgoalistoreachthelastindexintheminimumnu
cainiaoxiaomin
·
2020-08-17 21:27
笔试编程题
leetcode题
目 寻找最长回文字串
题目:GivenastringS,findthelongestpalindromicsubstringinS.YoumayassumethatthemaximumlengthofSis1000,andthereexistsoneuniquelongestpalindromicsubstring.思路:常见的解法有三种,时间复杂度分别为O(n3)、O(n2)、O(n)。本文分别实现这三类算法,贴出代
cainiaoxiaomin
·
2020-08-17 21:27
C++
LeetCode 14:最长公共前缀(Longest Common Prefix)解法汇总
OfficialApproach1:HorizontalscanningApproach2:VerticalscanningApproach3:DivideandconquerApproach4:Binarysearch更多
LeetCode
Ubuntu1996
·
2020-08-17 20:38
LeetCode刷题题解记录
LeetCode题
解:546-移除盒子
题目地址:https://leetcode-cn.com/problems/remove-boxes/题目描述:给出一些不同颜色的盒子,盒子的颜色由数字表示,即不同的数字表示不同的颜色。你将经过若干轮操作去去掉盒子,直到所有的盒子都去掉为止。每一轮你可以移除具有相同颜色的连续k个盒子(k>=1),这样一轮之后你将得到k*k个积分。当你将所有盒子都去掉之后,求你能获得的最大积分和。示例:数据范围:题
Wang_PChao
·
2020-08-17 20:54
编程算法
OJ平台刷题系列
LeetCode题
解(0647):字符串的回文子串数量(Python)
题目:原题链接(中等)标签:字符串解法时间复杂度空间复杂度执行用时Ans1(Python)O(N2)O(N^2)O(N2)O(1)O(1)O(1)120ms(94.10%)Ans2(Python)Ans3(Python)LeetCode的Python执行用时随缘,只要时间复杂度没有明显差异,执行用时一般都在同一个量级,仅作参考意义。解法一:classSolution:defcountSubstri
长行
·
2020-08-17 19:24
LeetCode题解
leetcode
python
字符串
LeetCode题
解(0678):判断包含通配符*的字符串中的括号是否有效(Python)
题目:原题链接(中等)标签:字符串、贪心算法解法时间复杂度空间复杂度执行用时Ans1(Python)O(N)O(N)O(N)O(N)O(N)O(N)24ms(100.00%)Ans2(Python)O(N)O(N)O(N)O(1)O(1)O(1)36ms(87.80%)Ans3(Python)LeetCode的Python执行用时随缘,只要时间复杂度没有明显差异,执行用时一般都在同一个量级,仅作参
长行
·
2020-08-17 19:24
LeetCode题解
leetcode
字符串
python
贪心算法
LeetCode题
解(0722):删除代码中的注释内容(Python)
题目:原题链接(中等)标签:字符串解法时间复杂度空间复杂度执行用时Ans1(Python)O(N)O(N)O(N)O(1)O(1)O(1)40ms(72.56%)Ans2(Python)Ans3(Python)解法一:classSolution:defremoveComments(self,source:List[str])->List[str]:removing=False#是否在被多行屏蔽的情
长行
·
2020-08-17 19:24
LeetCode题解
leetcode
python
字符串
LeetCode题
解(0609):在文件路径列表中查找重复内容的文件(Python)
题目:原题链接(中等)标签:字符串、哈希表解法时间复杂度空间复杂度执行用时Ans1(Python)O(N)O(N)O(N)O(N)O(N)O(N)104ms(91.87%)Ans2(Python)Ans3(Python)解法一:classSolution:deffindDuplicate(self,paths:List[str])->List[List[str]]:hashmap=collecti
长行
·
2020-08-17 19:23
LeetCode题解
python
leetcode
字符串
哈希表
LeetCode题
解(0632):包含每个列表中至少一个整数的最小区间(Python)
题目:原题链接(困难)标签:双指针、哈希表、滑动窗口、数学解法时间复杂度空间复杂度执行用时Ans1(Python)O(N2×K)O(N^2×K)O(N2×K)O(N×K)O(N×K)O(N×K)超出时间限制Ans2(Python)O(N2×K)O(N^2×K)O(N2×K)O(N×K)O(N×K)O(N×K)572ms(30.00%)Ans3(Python)O((N×K)log(N×K))O((N
长行
·
2020-08-17 19:23
LeetCode题解
python
leetcode
双指针
滑动窗口
数学
LeetCode题
解(python)-14. 最长公共前缀
LeetCode题
解(python)14.最长公共前缀题目描述编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串""。
Marshal Zheng
·
2020-08-17 19:04
算法
LeetCode题解
2019-5——60%
学习:1.每天20页《大话数据结构》,这个月把数据结构+算法知识补充一下(ok)2.每天2个
leetcode题
目,做对应数据结构的算法题目,巩固理解知识(no)3.lua框架学习,对比C#框架,思考优劣
微笑丶人生
·
2020-08-17 18:56
工作学习规划
【LeetCode】397. Integer Replacement 解题报告(Python)
【LeetCode】397.IntegerReplacement解题报告(Python)标签:
LeetCode题
目地址:https://leetcode.com/problems/integer-replacement
负雪明烛
·
2020-08-17 18:02
LeetCode
算法
LeetCode题
解目录
最新更新于2020.08.11.前往LeetCode主页。前往GitHub源码。(服务器原因,暂停同步。)前往码云主页。已解决289/1747-简单265中等10困难42020.06.30-2020.07.09,AC+100道(耗时10天),累计100道。2020.07.10-2020.07.19,AC+100道(耗时10天),累计200道。参赛记录场次题解LeetCode第200场周赛LeetC
HarvestWu
·
2020-08-17 18:51
LeetCode
LeetCode题
解(1342):将数字变成0的操作次数(Python)
题目:原题链接(简单)解法时间复杂度空间复杂度执行用时Ans1(Python)O(1)O(1)O(1)O(1)O(1)O(1)40ms(74.58%)Ans2(Python)Ans3(Python)LeetCode的Python执行用时随缘,只要时间复杂度没有明显差异,执行用时一般都在同一个量级,仅作参考意义。解法一(每一次要不进行一次右移位,要不移除一个个位的1):defnumberOfStep
长行
·
2020-08-17 18:42
LeetCode题解
leetcode
python
算法
数学
二进制
上一页
35
36
37
38
39
40
41
42
下一页
按字母分类:
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
其他