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题
目之删除重复元素(非有序列表)
今天做的这道题目是删除列表中的重复元素,是同之前的有序列表的题目不太一样,但是思路差不多,因此先看下题目:Givenanarraynumsandavalueval,removeallinstancesofthatvaluein-placeandreturnthenewlength.Donotallocateextraspaceforanotherarray,youmustdothisbymodif
做只幽默的程序袁
·
2020-07-07 23:48
Progra
leetcode题
目 200. 岛屿数量
题目给定一个由‘1’(陆地)和‘0’(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。示例示例1:输入:11110110101100000000输出:1示例2:输入:11000110000010000011输出:3解析大致就是一个dfs的过程,首先遍历一次地图,每找到一个’1’就将岛屿数递加,进行dfs,
陈迹·清欢
·
2020-07-07 23:58
leetcode刷题
Leetcode刷题:剑指offer【面试题16 数值的整数次方】
Leetcode题
目对应位置:面试题16:数值的整数次方实现特定库函数(处理数值和字符串的函数)的功能是一类常见的面试题。测试考虑
yaoyz105
·
2020-07-07 21:47
今天刷题了吗
Leetcode刷题:剑指offer【面试题38 字符串的排列】
Leetcode题
目对应位置:面试题38:字符串的排列思路:将字符串看作两部分,即:字符串的首字符+剩下的字符。
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题45 把数组排成最小的数】
Leetcode题
目对应位置:面试题45:把数组排成最小的数思路:其实这就是一个排序问题,只不过排序规则不是常规的比较大小。
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题46 把数字翻译成字符串】
Leetcode题
目对应位置:面试题46:把数字翻译成字符串思路:动态规划问题。观察发现,不断扩展一个数字串时,如果新添加的数字和前一位数字不能合并为一个可
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题28 对称的二叉树】
Leetcode题
目对应位置:面试题28:对称的二叉树思路:递归画个对称二叉树能看出,如果它是对称的,那么对称节点L和R的子节点中,L的左子节点与R的右子节点对称,L的右子节点与R的左子节点对称。
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题21 调整数组顺序使奇数位于偶数前面】
Leetcode题
目对应位置:面试题21:调整数组顺序使奇数位于偶数前面思路1:常规循环不考虑时间复杂度,最简单的思路就是从头到尾扫描数组,每碰到一个偶数就取出,把该数后
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题50 第一个只出现一次的字符】
Leetcode题
目对应位置:面试题50:第一个只出现一次的字符思路:暴力法。遍历整个字符串,对每个字符进行计数(用哈希表),最后再次遍历哈希表,找到值为1的字符串键即可。
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题19 正则表达式匹配】
Leetcode题
目对应位置:面试题19:正则表达
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题22 链表中倒数第k个节点】
Leetcode题
目对应位置:面试题22:链表中倒数第k个节点常规解法是先遍历一遍单链表,求得链表长度
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题47 礼物的最大价值】
Leetcode题
目对应位置:面试题47:礼物的最大价值思路:动态规划问题。明确状态:棋盘上每个格子的状态是走到当前格子能拿到的最大价
yaoyz105
·
2020-07-07 21:16
今天刷题了吗
Leetcode刷题:剑指offer【面试题10-1 斐波那契数列】
Leetcode题
目对应位置:面试题10-1:斐波那契数列思路1:递归(自上而下)最直观的思路就是递归求解,
yaoyz105
·
2020-07-07 21:15
今天刷题了吗
Leetcode刷题:剑指offer【面试题17 打印从1到最大的n位数】
Leetcode题
目对应位置:面试题17:打印从1到最大的n位数陷阱:包含大数问题,即如果n很大,很可能会出现溢出,所以不能用循环直接求最大的数字然后循环打印。如果面试题
yaoyz105
·
2020-07-07 21:15
今天刷题了吗
Leetcode刷题:剑指offer【面试题11 旋转数组的最小数字】
Leetcode题
目对应位置:面试题11:旋转数组的最小数字最直观的思路就是从头到尾遍历数组,但是时间复杂度为O(n),且没有
yaoyz105
·
2020-07-07 21:15
今天刷题了吗
LeetCode题
解之动态规划(longest-palindromic-substring)
longest-palindromic-substringclassSolution{public:/*动态规划求解最长回文串时间复杂度为O(n^2)dp[i][j]为true表示下标i~j的子串是回文串以str="eabcbaf"为例,二维dp表如下eabcbafe1000000a100010b10100c1000b100a10f1当j=4,i=2时,更新left=2,right=4,maxLe
城阙
·
2020-07-07 20:40
算法
c++
刷题
leetcode题
解-Combination Sum系列
这个系列一共有四道题,每道题目之间稍微有些不同,下面通过对比来总结一下,四道题目都可以使用backtracking回溯方法做,当然也可以是使用DP进行求解。首先看第一道:39.CombinationSumGivenasetofcandidatenumbers(C)(withoutduplicates)andatargetnumber(T),findalluniquecombinationsinCw
liuchongee
·
2020-07-07 14:54
leetcode刷题
leetcode题
解-647. Palindromic Substrings && 5. Longest Palindromic Substring
题目:Givenastring,yourtaskistocounthowmanypalindromicsubstringsinthisstring.Thesubstringswithdifferentstartindexesorendindexesarecountedasdifferentsubstringseventheyconsistofsamecharacters.Example1:Inpu
liuchongee
·
2020-07-07 14:23
leetcode刷题
LeetCode题
解——56. 合并区间
题目相关题目链接LeetCode中国,https://leetcode-cn.com/problems/merge-intervals/。题目描述给出一个区间的集合,请合并所有重叠的区间。示例示例1输入:[[1,3],[2,6],[8,10],[15,18]]输出:[[1,6],[8,10],[15,18]]解释:区间[1,3]和[2,6]重叠,将它们合并为[1,6].示例2输入:[[1,4],[
努力的老周
·
2020-07-07 12:00
OJ题解
#
LeetCode题解
Leetcode题
解-62. Unique Paths & 63. Unique Paths II
Leetcode题
解-62.UniquePaths&63.UniquePathsII62.UniquePathsArobotislocatedatthetop-leftcornerofamxngrid(
hzw2945
·
2020-07-07 10:08
Leetcode
Leetcode题
解-55. Jump Game
Leetcode题
解-55.JumpGameGivenanarrayofnon-negativeintegers,youareinitiallypositionedatthefirstindexofthearray.Eachelementinthearrayrepresentsyourmaximumjumplengthatthatposition.Determineifyouareabletore
hzw2945
·
2020-07-07 10:07
Leetcode
Leetcode题
解-198. House Robber
Leetcode题
解-198.HouseRobberYouareaprofessionalrobberplanningtorobhousesalongastreet.Eachhousehasacertainamountofmoneystashed
hzw2945
·
2020-07-07 10:36
Leetcode
Leetcode题
解-6. ZigZag Conversion
Leetcode题
解-6.ZigZagConversionThestring"PAYPALISHIRING"iswritteninazigzagpatternonagivennumberofrowslikethis
hzw2945
·
2020-07-07 10:36
Leetcode
Leetcode题
解-617. Merge Two Binary Trees
Leetcode题
解-617.MergeTwoBinaryTreesGiventwobinarytreesandimaginethatwhenyouputoneofthemtocovertheother
hzw2945
·
2020-07-07 10:36
Leetcode
Leetcode题
解-31. Next Permutation
Leetcode题
解-31.NextPermutationImplementnextpermutation,whichrearrangesnumbersintothelexicographicallynextgreaterpermutationofnumbers.Ifsucharrangementisnotpossible
hzw2945
·
2020-07-07 10:36
Leetcode
Leetcode题
解-747. Min Cost Climbing Stairs
Leetcode题
解-747.MinCostClimbingStairsOnastaircase,thei-thstephassomenon-negativecostcost[i]assigned(0indexed
hzw2945
·
2020-07-07 10:36
Leetcode
leetcode 190 颠倒二进制位(Reverse Bits) python 一行代码
所有
Leetcode题
目不定期汇总在Github,欢迎大家批评指正,讨论交流。'''
每一个有风的日子
·
2020-07-07 10:57
【leetcode】
刷题总结
&
编程心得
leetcode 7 Reverse Integer(反转整数) python3 两种解法(反转str/取余操作)
所有
Leetcode题
目不定期汇总在Github,欢迎大家批评指正,讨论交流。
每一个有风的日子
·
2020-07-07 10:57
【leetcode】
刷题总结
&
编程心得
leetcode 202 Happy Number 快乐数 python 多种实现,最简代码
所有
Leetcode题
目不定期汇总在Github,欢迎大家批评指正,讨论交流。
每一个有风的日子
·
2020-07-07 10:57
【leetcode】
刷题总结
&
编程心得
LeetCode题
解:3. Longest Substring Without Repeating Characters
题目中文翻译如下:找出一个字符串的无重复字母的最长子字符串。例如:"abcabcbb"的无重复字母最长子字符串是"abc","pwwkew"的无重复字母最长子字符串是"wke"思考:动态规划的典型应用,保存当前最长字串和包含当前字母的最长字串,遍历一遍就好,重点考虑一下边界,代码如下:publicintlengthOfLongestSubstring(Strings){HashMapcurSet=
htjovi
·
2020-07-07 09:53
leetcode题解
Leetcode题
解——20. 有效的括号
20.有效的括号题解1:取巧的解法classSolution:defisValid(self,s:str)->bool:while'{}'insor'()'insor'[]'ins:s=s.replace('{}','')s=s.replace('[]','')s=s.replace('()','')returns==''题解2:使用栈step1:初始化栈S。step2:依次处理表达式的每个括号。
子季鹰才
·
2020-07-07 09:33
Leetcode题
解——38. 外观数列
38.外观数列题解:classSolution:defcountAndSay(self,n:int)->str:ifn==1:return'1'new_str=''last_str=self.countAndSay(n-1)#获取上次的报数cur=last_str[0]#当前要统计的字符,初始值为last_str的首字符cur_t=0#当前字符出现的次数foriinlast_str:ifi==cu
子季鹰才
·
2020-07-07 09:32
Leetcode题
解——DFS+染色问题
涉及到的题目:886.可能的二分法785.判断二分图此类题目的关键在于构建图,然后将一条边上两个点着不同的颜色,当着色方案为2种颜色时,即为所说的二分图问题。886.可能的二分法classSolution:defpossibleBipartition(self,N:int,dislikes:List[List[int]])->bool:color={}graph=collections.defau
子季鹰才
·
2020-07-07 09:32
Leetcode题
解——动态规划一网打尽股票买卖问题
股票买卖问题涉及到的题目:121.买卖股票的最佳时机122.买卖股票的最佳时机II309.最佳买卖股票时机含冷冻期714.买卖股票的最佳时机含手续费123.买卖股票的最佳时机III188.买卖股票的最佳时机IV此系列的题目可以用状态机的技巧来解决,实际上就是动态规划的DPtable,具体可参考团灭LeetCode股票买卖问题具体来说,要构建的动态规划数组为dp[i][k][0or1]0int:n=
子季鹰才
·
2020-07-07 09:02
[LeetCode] 025. Reverse Nodes in k-Group (Hard) (C++/Java)
索引:[LeetCode]
Leetcode题
解索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode025.ReverseNodesink-Group
hcbbt
·
2020-07-07 09:23
=====算法相关=====
+Leetcode
+基础算法
Leetcode
题解
[LeetCode] 010. Regular Expression Matching (Hard) (C++/Java/Python)
索引:[LeetCode]
Leetcode题
解索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode010.Regular_Expression_Matching
hcbbt
·
2020-07-07 09:23
=====算法相关=====
+基础算法
+Leetcode
Leetcode
题解
LeetCode题
解--2. Add Two Numbers
链接
LeetCode题
目:https://leetcode.com/problems/add-two-numbers/GitHub代码:https://github.com/gatieme/LeetCode
JeanCheng
·
2020-07-07 08:21
┈┈【LeetCode
面试题】
【LeetCode】673. Number of Longest Increasing Subsequence 解题报告(Python)
【LeetCode】673.NumberofLongestIncreasingSubsequence解题报告(Python)标签(空格分隔):
LeetCode题
目地址:https://leetcode.com
负雪明烛
·
2020-07-07 08:27
LeetCode
算法
Leetcode题
解——算法思想之动态规划
斐波那契数列1.爬楼梯2.强盗抢劫3.强盗在环形街区抢劫4.信件错排5.母牛生产矩阵路径1.矩阵的最小路径和2.矩阵的总路径数数组区间1.数组区间和2.数组中等差递增子区间的个数分割整数1.分割整数的最大乘积2.按平方数来分割整数3.分割整数构成字母字符串最长递增子序列1.最长递增子序列2.一组整数对能够构成的最长链3.最长摆动子序列最长公共子序列0-1背包1.划分数组为和相等的两部分2.改变一组
dieshi8689
·
2020-07-07 06:11
[leetcode]图算法之判断有向图有无环802. Find Eventual Safe States
图算法之判断有向图有无环802.FindEventualSafeStates题目题解代码优化(使用DFS+染色)题目
leetcode题
目入口题解判断有向图有无环:不断删去出度为0的结点以及与之相连的边,
crabstew
·
2020-07-07 05:57
leetcode
图
Redundant Connection II 解法
RedundantConnectionII解法第19周题目难度:Hard
LeetCode题
号:685题目Description:Inthisproblem,arootedtreeisadirectedgraphsuchthat
chenh297
·
2020-07-07 05:37
算法题
leetcode题
解:第25题Reverse Nodes in k-Group
题目ReverseNodesink-GroupGivenalinkedlist,reversethenodesofalinkedlistkatatimeandreturnitsmodifiedlist.kisapositiveintegerandislessthanorequaltothelengthofthelinkedlist.Ifthenumberofnodesisnotamultipleo
chenf99
·
2020-07-07 05:11
算法
LeetCode题
解系列--309. Best Time to Buy and Sell Stock with Cooldown
描述Sayyouhaveanarrayforwhichtheithelementisthepriceofagivenstockondayi.Designanalgorithmtofindthemaximumprofit.Youmaycompleteasmanytransactionsasyoulike(ie,buyoneandselloneshareofthestockmultipletimes)
bowen_wu_
·
2020-07-07 04:18
C++
leetcode
LeetCode题
解系列--123. Best Time to Buy and Sell Stock III
描述Sayyouhaveanarrayforwhichtheithelementisthepriceofagivenstockondayi.Designanalgorithmtofindthemaximumprofit.Youmaycompleteatmosttwotransactions.Note:Youmaynotengageinmultipletransactionsatthesametim
bowen_wu_
·
2020-07-07 04:18
C++
leetcode
LeetCode题
解系列--763. Partition Labels
描述AstringSoflowercaselettersisgiven.Wewanttopartitionthisstringintoasmanypartsaspossiblesothateachletterappearsinatmostonepart,andreturnalistofintegersrepresentingthesizeoftheseparts.Example1:Input:S=
bowen_wu_
·
2020-07-07 04:46
C++
leetcode
LeetCode题
解系列--188. Best Time to Buy and Sell Stock IV
描述Sayyouhaveanarrayforwhichtheithelementisthepriceofagivenstockondayi.Designanalgorithmtofindthemaximumprofit.Youmaycompleteatmostktransactions.Note:Youmaynotengageinmultipletransactionsatthesametime(
bowen_wu_
·
2020-07-07 04:46
C++
leetcode
LeetCode题
解系列--122. Best Time to Buy and Sell Stock II
描述Sayyouhaveanarrayforwhichtheithelementisthepriceofagivenstockondayi.Designanalgorithmtofindthemaximumprofit.Youmaycompleteasmanytransactionsasyoulike(ie,buyoneandselloneshareofthestockmultipletimes)
bowen_wu_
·
2020-07-07 04:15
C++
leetcode
LeetCode题
解系列--718. Maximum Length of Repeated Subarray
描述GiventwointegerarraysAandB,returnthemaximumlengthofansubarraythatappearsinbotharrays.Example1:Input:A:[1,2,3,2,1]B:[3,2,1,4,7]Output:3Explanation:Therepeatedsubarraywithmaximumlengthis[3,2,1].Note:1
bowen_wu_
·
2020-07-07 04:15
C++
leetcode
LeetCode题
解系列--685. Redundant Connection II
描述Inthisproblem,arootedtreeisadirectedgraphsuchthat,thereisexactlyonenode(theroot)forwhichallothernodesaredescendantsofthisnode,pluseverynodehasexactlyoneparent,exceptfortherootnodewhichhasnoparents.T
bowen_wu_
·
2020-07-07 04:14
C++
leetcode
LeetCode题
解(Golang实现)--Longest Substring Without Repeating Characters
题目Givenastring,findthelengthofthelongestsubstringwithoutrepeatingcharacters.Examples:Given"abcabcbb",theansweris"abc",whichthelengthis3.Given"bbbbb",theansweris"b",withthelengthof1.Given"pwwkew",thean
EvansJang
·
2020-07-07 02:10
Go语言
LeetCode
上一页
46
47
48
49
50
51
52
53
下一页
按字母分类:
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
其他