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算法
Leetcode题
目本文将不断更新,主要内容为解决Leetcode中的算法问题,有比较难的题目可能会单独成文档,所有代码都将用Javascript编写并且Accepted.标题后面的百分号代表用JS写的代码中该答案比多少比例的答案快
机智的马里奥
·
2020-07-07 01:58
LeetCode题
解-25-Reverse Nodes in k-Group
原题简介该题共有2种解法,一种迭代,一种递归。迭代法解题思路每一次取K个节点作为子链表,将其反转,然后将反转后的子链表添加到新的链表中。图解代码publicclassSolution25{publicListNodereverseKGroup(ListNodehead,intk){if(head==null||head.next==null||k0){//reversecurrentk-group
WangT443
·
2020-07-07 01:43
LeetCode
LeetCode题
目:最小栈
设计一个支持push,pop,top操作,并能在常数时间内检索到最小元素的栈。push(x)–将元素x推入栈中。pop()–删除栈顶的元素。top()–获取栈顶元素。getMin()–检索栈中的最小元素。示例:MinStackminStack=newMinStack();minStack.push(-2);minStack.push(0);minStack.push(-3);minStack.ge
Hello、MrTree
·
2020-07-07 00:50
LeetCode
leetcode题
目总结 --- 4sum
1题目给出一个有n个元素的数组S,S中是否有元素a,b,c和d满足a+b+c+d=目标值?找出数组S中所有满足条件的四元组。注意:四元组(a、b、c、d)中的元素必须按非降序排列。(即a≤b≤c≤d)解集中不能包含重复的四元组。例如:给出的数组S={10-10-22},目标值=0.↵↵给出的解集应该是:↵(-1,0,0,1)↵(-2,-1,1,2)↵(-2,0,0,2)2解法2.1我的第一版解法写
就着嘎巴菜喝大碴粥
·
2020-07-06 23:06
刷题
Leetcode题
解:4. Longest Substring Without Repeating Characters
Leetcode题
解:4.LongestSubstringWithoutRepeatingCharacters难度:Medium题目Givenastring,findthelengthofthelongestsubstringwithoutrepeatingcharacters.Examples
Littlecuter
·
2020-07-06 22:33
Leetcode~
leetcode题
解-25. Reverse Nodes in k-Group
题意:把原始链表k个k个的反转,如果最后剩余的不到k个结点,那么保持不变。例子:给定链表:1->2->3->4->5如果k=2,返回链表:2->1->4->3->5如果k=3,返回链表:3->2->1->4->5分析:前两天十大上有师兄分享17年算法岗面经时提到了本题,因此在做本题的时候也格外认真。晚上洗澡的时候理了一下思路,然后手写代码bug-free,还是很开心的。题目本身是几道题的综合,因此
北邮张博
·
2020-07-06 22:33
Leetcode题解
leetcode题
解-23. Merge k Sorted Lists
题意:合并k个有序的链表,分析描述算法的复杂度。分析:这道题目在分布式系统中非常常见,来自不同client的sortedlist要在centralserver上面merge起来。解法就是有点类似于归并排序的思路,就是分治法,不了解归并排序的朋友,请参见归并排序-维基百科,是一个比较经典的O(nlogn)的排序算法,还是比较重要的。思路是先分成两个子任务,然后递归求子任务,最后回溯回来。这个题目也是
北邮张博
·
2020-07-06 22:33
Leetcode题解
leetcode题
解-44. Wildcard Matching
分析:这道题和
leetcode题
解-10.RegularExpressionMatching相似,不同的是*可以匹配一串序列。
北邮张博
·
2020-07-06 22:33
Leetcode题解
Leetcode题
解-6.regular-expression-matching
[TOC]题目背景https://leetcode-cn.com/problems/longest-palindromic-substring/给你一个字符串s和一个字符规律p,请你来实现一个支持'.'和'*'的正则表达式匹配。'.'匹配任意单个字符'*'匹配零个或多个前面的那一个元素所谓匹配,是要涵盖整个字符串s的,而不是部分字符串。说明:s可能为空,且只包含从a-z的小写字母。p可能为空,且只
A94583879
·
2020-07-06 20:43
Leetcode题
解 - 3. Longest Substring Without Repeating Characters
题目Givenastring,findthelengthofthelongestsubstringwithoutrepeatingcharacters.给定一个字符串,找出其中最长的没有重复字符的子串。Examples:Given"abcabcbb",theansweris"abc",whichthelengthis3.Given"bbbbb",theansweris"b",withtheleng
xuelians
·
2020-07-06 20:02
LeetCode题
解——684. 冗余连接(并查集)
题目https://leetcode-cn.com/problems/redundant-connection/在本问题中,树指的是一个连通且无环的无向图。输入一个图,该图由一个有着N个节点(节点值不重复1,2,…,N)的树及一条附加的边构成。附加的边的两个顶点包含在1到N中间,这条附加的边不属于树中已存在的边。结果图是一个以边组成的二维数组。每一个边的元素是一对[u,v],满足u
从程序猿到程序员
·
2020-07-06 18:24
LeetCode
leetcode题
目之括号匹配问题
关于括号匹配问题,提到这个问题就会想到数据结构栈,关于括号匹配大家也都是熟悉不过了,不过今天刷起这道题,还是让我花了一些时间去回忆这里面的一些细节,尤其是用python去复现的时候。首先看一下问题描述:Givenastringcontainingjustthecharacters'(',')','{','}','['and']',determineiftheinputstringisvalid.A
做只幽默的程序袁
·
2020-07-06 17:18
Progra
LeetCode题
解-3-Longest Substring Without Repeating Characters
解题思路首先要读懂题目,它要求的是找到最长的子串,并且子串中没有出现重复的字符。我的想法,是用一个map存储每个字符最后出现的位置,还要有个变量start,它用来记录上一次出现重复的位置,如果当前字符上一次出现的位置比start小,那么说明中间出现了重复,不能当成有效的子串。记得就是在扫描结束后,再判断一下最后一段子串。给个图简单说明一下。参考源码publicclassSolution{publi
小毛1983
·
2020-07-06 17:44
LeetCode
LeetCode题
解-10-Regular Expression Matching
解题思路思路是动态规划。假设s是待匹配字符串,p是表达式。定义数组matchs,其中matchs[i,j]表示s[0,i)和p[0,j)是否匹配,那么结果就是求matchs[s长度加1,p长度加1]。对于matchs[i,j]分以下情况:*i=0,j=0,空的肯定能匹配*i=0,j!=0,那么在j>1的情况下且p[j-1]是星号的时候,match[0,j]=match[0,j-2],相当于是.*结
小毛1983
·
2020-07-06 17:13
LeetCode
leetcode题
解-3. Longest Substring Without Repeating Characters
题目:Givenastring,findthelengthofthelongestsubstringwithoutrepeatingcharacters.Examples:Given“abcabcbb”,theansweris“abc”,whichthelengthis3.Given“bbbbb”,theansweris“b”,withthelengthof1.Given“pwwkew”,thea
liuchongee
·
2020-07-06 17:21
leetcode刷题
Leetcode题
解-3. Longest Substring Without Repeating Characters
3.LongestSubstringWithoutRepeatingCharactersGivenastring,findthelengthofthelongestsubstringwithoutrepeatingcharacters.Examples:Given"abcabcbb",theansweris"abc",whichthelengthis3.Given"bbbbb",theanswer
hzw2945
·
2020-07-06 16:49
Leetcode
Leetcode题
解-25. Reverse Nodes in k-Group
Leetcode题
解-25.ReverseNodesink-GroupGivenalinkedlist,reversethenodesofalinkedlistkatatimeandreturnitsmodifiedlist.kisapositiveintegerandislessthanorequaltothelengthofthelinkedlist.Ifthenumberofnodesisn
hzw2945
·
2020-07-06 16:49
Leetcode
Leetcode题
解-5. Longest Palindromic Substring
5.LongestPalindromicSubstringGivenastrings,findthelongestpalindromicsubstringins.Youmayassumethatthemaximumlengthofsis1000.Example:Input:"babad"Output:"bab"Note:"aba"isalsoavalidanswer.Example:Input:"
hzw2945
·
2020-07-06 16:49
Leetcode
《LeetBook》
leetcode题
解(10): Regular Expression Matching——DP解决正则匹配
我现在在做一个叫《leetbook》的免费开源书项目,力求提供最易懂的中文思路,目前把解题思路都同步更新到gitbook上了,需要的同学可以去看看书的地址:https://hk029.gitbooks.io/leetbook/010.RegularExpressionMatching问题Implementregularexpressionmatchingwithsupportfor‘.’and‘*
Vosky
·
2020-07-06 16:32
《LeetCode》解题笔记
Leetcode题
解——数据结构之树
递归1.树的高度2.平衡树3.两节点的最长路径4.翻转树5.归并两棵树6.判断路径和是否等于一个数7.统计路径和等于一个数的路径数量8.子树9.树的对称10.最小路径11.统计左叶子节点的和12.相同节点值的最大路径长度13.间隔遍历14.找出二叉树中第二小的节点层次遍历1.一棵树每层节点的平均数2.得到左下角的节点前中后序遍历1.非递归实现二叉树的前序遍历2.非递归实现二叉树的后序遍历3.非递归
dieshi8689
·
2020-07-06 16:25
LeetCode题
解系列--5. Longest Palindromic Substring
描述Givenastrings,findthelongestpalindromicsubstringins.Youmayassumethatthemaximumlengthofsis1000.Example:Input:“babad”Output:“bab”Note:“aba”isalsoavalidanswer.Example:Input:“cbbd”Output:“bb”难度:medium这道
bowen_wu_
·
2020-07-06 16:22
leetcode
leetcode
leetcode题
解第23题 Merge k Sorted Lists(合并K个排序链表)
题目大意如下:给定k个有序链表,请将这k个列表合并成一个有序链表,然后返回这个有序列表的头结点。在python中,链表被这样实现:#Definitionforsingly-linkedlist.classListNode:def__init__(self,x):self.val=xself.next=None样例输入:[1->4->5,1->3->4,2->6]样例输出:1->1->2->3->4
笔墨留年
·
2020-07-06 15:08
leetcode题解
【
LeetCode题
解---003】Longest Substring Without Repeating Characters
题目Givenastring,findthelengthofthelongestsubstringwithoutrepeatingcharacters.Example1:Input:"abcabcbb"Output:3Explanation:Theansweris"abc",withthelengthof3.Example2:Input:"bbbbb"Output:1Explanation:The
程序猿杂货铺
·
2020-07-06 15:52
LeetCode
【
LeetCode题
解-005】longest Palindrome Substring
题目Givenastrings,findthelongestpalindromicsubstringins.Youmayassumethatthemaximumlengthofsis1000.Example1:Input:"babad"Output:"bab"Note:"aba"isalsoavalidanswer.Example2:Input:"cbbd"Output:"bb"原题地址:http
程序猿杂货铺
·
2020-07-06 15:52
LeetCode
Leetcode200.岛屿数量——并查集
文章目录引入并查集算法细节
Leetcode题
解引入在leetcode中遇到这样一道题:200.岛屿数量给定一个由‘1’(陆地)和‘0’(水)组成的的二维网格,计算岛屿的数量。
No_Game_No_Life_
·
2020-07-06 15:30
LeetCode
LeetCode题
目解析(二):10、Regular Expression Matching
10、正则表达式匹配一、问题描述:实现一个支持’.’和’*’的正则表达式匹配算法。其中’.’可以匹配任意字符,’*’可以使其前面的字符匹配一个或多个。匹配应当覆盖整个字符串而不是部分。给出的函数原型为boolisMatch(constchar*s,constchar*p)例如:isMatch(“aa”,”a”)→falseisMatch(“aa”,”aa”)→trueisMatch(“aaa”,”
Kiritoku
·
2020-07-06 15:34
LeetCode
leetcode题
解-10. Regular Expression Matching
题意:正则匹配。比较两个字符串是否一致,这里有两个特殊符号“.”和“∗”,”.”可以匹配单个字符,而”∗”可以匹配任意个与前一字符相同的字符。分析:按照Solution中的思路,有递归和动态规划两种方法。而这道题使用动态规划不仅方便易懂,而且代码也非常整洁。首先看一下伪代码:看起来很精简,但是要真正理解,我还是用了一下午的时间。下面我们从头开始说明一下构造dp二维数组的过程。举例:s=“aab”p
北邮张博
·
2020-07-06 15:29
Leetcode题解
LeetCode题
解--7. Reverse Integer
链接7.Reverse_Integer(Easy)题目:https://leetcode.com/problems/Reverse-Integer/代码(github):https://github.com/gatieme/LeetCode/tree/master/007-ReverseIntegerCSDN题解;http://blog.csdn.net/gatieme/article/detai
JeanCheng
·
2020-07-06 15:41
┈┈【LeetCode
面试题】
LeetCodet题解--23. Merge k Sorted Lists(合并K个已排序的链表)
链接
LeetCode题
目:https://leetcode.com/problems/merge-k-sorted-listsGitHub代码:https://github.com/gatieme/LeetCode
JeanCheng
·
2020-07-06 15:06
┈┈【LeetCode
面试题】
LeetCodet题解--21. Merge Two Sorted Lists(合并两个排序好的链表)
链接
LeetCode题
目:https://leetcode.com/problems/merge-two-sorted-listsGitHub代码:https://github.com/gatieme/
JeanCheng
·
2020-07-06 15:34
┈┈【LeetCode
面试题】
LeetCodet题解--18. 4Sum(4个数的和)
链接
LeetCode题
目:https://leetcode.com/problems/4sumGitHub代码:https://github.com/gatieme/LeetCode/tree/master
JeanCheng
·
2020-07-06 15:34
┈┈【LeetCode
面试题】
LeetCode题
解--3. Longest Substring Without Repeating Characters
LeetCode题
目地址:https://leetcode.com/problems/longest-substring-without-repeating-characters/GitHub代码:https
JeanCheng
·
2020-07-06 15:34
┈┈【LeetCode
面试题】
LeetCode题
解--10. Regular Expression Matching
链接
LeetCode题
目:https://leetcode.com/problems/regular-expression-matching/GitHub代码:https://github.com/gatieme
JeanCheng
·
2020-07-06 15:34
┈┈【LeetCode
面试题】
LeetCodet题解--22. Generate Parentheses(生成n对匹配的括号)
链接
LeetCode题
目:https://leetcode.com/problems/generate-parenthesesGitHub代码:https://github.com/gatieme/LeetCode
JeanCheng
·
2020-07-06 15:34
┈┈【LeetCode
面试题】
LeetCode题
目C++实现:3. 无重复字符的最长子串
3.无重复字符的最长子串给定一个字符串,请你找出其中不含有重复字符的最长子串的长度。示例1:输入:“abcabcbb”输出:3解释:因为无重复字符的最长子串是“abc”,所以其长度为3。示例2:输入:“bbbbb”输出:1解释:因为无重复字符的最长子串是“b”,所以其长度为1。示例3:输入:“pwwkew”输出:3解释:因为无重复字符的最长子串是“wke”,所以其长度为3。请注意,你的答案必须是子
CCoC
·
2020-07-06 13:24
LeetCode
1450. 在既定时间做作业的学生人数
题目来源
leetcode题
目描述题目解析水题classSolution{publicintbusyStudent(int[]startTime,int[]endTime,intqueryTime){intcnt
Ocean&&Star
·
2020-07-06 12:42
LeetCode 121. Best Time to Buy and Sell Stock--Java,Python,C++解法
BestTimetoBuyandSellStock此文首发于我的个人博客:LeetCode121.BestTimetoBuyandSellStock–Java,Python,C++解法—zhang0peter的个人博客
LeetCode
zhang0peter
·
2020-07-06 12:25
LeetCode
python-做题
c++-做题
【leetcode】718 最长重复子数组(滑动窗口解法)
前言这是今日的每日一题,但是
leetcode题
解里对滑动窗口的解法动图之类有特别强烈的误导性,导致一般很难写出滑动窗口的解法。
业火之理
·
2020-07-06 10:38
leetcode
数据结构与算法
LeetCode刷题指南——题目精选1
这是LeetCode经典题目总结文章~基础:将数据结构及算法学习的差不多,
LeetCode题
目按类别刷题及总结,参考鄙人数据结构及算法系列文章~按类别将每类题目做好,大概刷250道左右的程度即可。
xutiantian1412
·
2020-07-06 09:20
python数据结构与算法
LeetCode
删除单链表中的倒数第n个节点(Java实现)
LeetCode题
目链接(https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/submissions/)ADT:publicclassListNode
ming_rw
·
2020-07-06 05:30
数据结构与算法
Leetcode--最大正方形
示例:输入:10100101111111110010输出:4思路参考
Leetcode题
解,详细解析可以查看原链接;dp[i][j]=min(dp[i-1][j-1],min(dp[i-1][j],dp[
半途行走
·
2020-07-06 03:22
leetcode
Leetcode--另一个树的子树
思路参考
Leetcode题
解;先找到值相等的两个
半途行走
·
2020-07-06 03:22
leetcode
LeetCode7 整数反转 C++, Java, Python
力扣(LeetCode)链接:https://leetcode-cn.com/problems/reverse-integer/博主Github:https://github.com/GDUT-Rp/
LeetCode
Rp_
·
2020-07-06 03:21
Leetcode
Leetcode面试题18 删除链表的节点 C++,Java,Python
://leetcode-cn.com/problems/shan-chu-lian-biao-de-jie-dian-lcof/博主Github:https://github.com/GDUT-Rp/
LeetCode
Rp_
·
2020-07-06 03:20
Leetcode
Leetcode145 二叉树的后序遍历 C++,Java,Python
https://leetcode-cn.com/problems/binary-tree-postorder-traversal/博主Github:https://github.com/GDUT-Rp/
LeetCode
Rp_
·
2020-07-06 03:20
Leetcode
Leetcode1 两数之和 C++,Java,Python
Leetcode1两数之和来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/two-sum/博主Github:https://github.com/GDUT-Rp/
LeetCode
Rp_
·
2020-07-06 03:20
Leetcode
深度学习提高泛化能力的技术
LeetCode题
目记录1.泛化能力(generalization)2.正则化(regularization)2.1正则化方法1.泛化能力(generalization)对于模型,我们不仅要求它对训练数据集有很好的拟合
视界IT
·
2020-07-06 03:48
算法梳理
Leetcode遇上C++(一)
前言:为了锻炼自己的编程能力,决定尝试着刷下
Leetcode题
库,也为自己毕业时找软件开发岗位打下基础,当然咯,作为非科班出身的我,在编程上面还有很大的问题,甚至连最基本的知识都未掌握好,但是,我相信功夫不负有心人
行歌er
·
2020-07-06 03:14
leetcode
LeetCode 面试题 01.05. 一次编辑
LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/Algorithmcii
LeetCode
图灵的图,图灵的灵。
·
2020-07-06 02:00
leetcode 10 Regular Expression Matching(简单正则表达式匹配)
做了很多
leetcode题
目,我们来总结一下套路:首先一般是检查输入参数是否正确,然后是处理算法的特殊情况
weixin_34129145
·
2020-07-06 00:16
上一页
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
其他