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题解
C++ Two Sum
最近要开始准备实习了,为了让自己显得不那么弱,所以拾起了以前的A题的感觉,开始在大名鼎鼎的LeetCode上开始刷题,废话不多说了,就从第一题开始吧。1.TwoSumGivenanarrayofintegers,returnindicesofthetwonumberssuchthattheyadduptoaspecifictarget.Youmayassumethateachinputwouldh
CaffeyChen
·
2020-06-24 15:53
C++
LeetCode
LeetCode题解
汇总
LeetCode题解
汇总
LeetCode题解
总结目录,C++语言题号题目难度解析连接4两个排序数组的中位数hardC++5最长回文子串mediumC++17电话号码的字母组合mediumC++23合并K
沧海漂游_
·
2020-06-24 10:23
Leetdode
合并k个有序链表,
LeetCode题解
(二)
Input:[ 1->4->5, 1->3->4, 2->6]Output:1->1->2->3->4->4->5->6合并链表很简单,而且还是有序的,k个指针前进就行。写代码的时候只要随时记得保持良好习惯,尽量用少量的判断来包括多种条件进去,这样写出来的代码就不会和严蔚敏的数据结构书上一样丑了。#Definitionforsingly-linkedlist.#classListNode(obje
import_SOBER
·
2020-06-24 09:00
Leetcode题解
之数组
一完美的数组逆置算法整型数组的逆置算法合理利用泛型封装类型与基本类型的各自适用范围二旋转数组Leetcode189三和为s的两个数字四和为s的连续正整数序列五删除排序数组中的重复元素leetcode26一完美的数组逆置算法1.整型数组的逆置算法最简单的首尾互换:2.合理利用泛型3.封装类型与基本类型的各自适用范围二旋转数组Leetcode189Leetcode189.RotateArray三步反转
刘焌烊
·
2020-06-24 06:36
数据结构与算法分析
leetcode题解
-138. Copy List with Random Pointer
题目:Alinkedlistisgivensuchthateachnodecontainsanadditionalrandompointerwhichcouldpointtoanynodeinthelistornull.Returnadeepcopyofthelist.本题与前面的链表结构都不太一样,其每个节点都有next和random两个指针,题目要求对该链表进行深度拷贝,也就是说必须返回一个与
liuchongee
·
2020-06-24 06:21
leetcode刷题
leetcode题解
-49. Group Anagrams
题目:Givenanarrayofstrings,groupanagramstogether.Forexample,given:[“eat”,“tea”,“tan”,“ate”,“nat”,“bat”],Return:[[“ate”,“eat”,”tea”],[“nat”,”tan”],[“bat”]]思路1,使用前面的题目来判断两个字符串是否为anagrams,这样有两种做法,第一个是循环嵌套,
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode题解
-535. Encode and Decode TinyURL
题目:TinyURLisaURLshorteningservicewhereyouenteraURLsuchashttps://leetcode.com/problems/design-tinyurlanditreturnsashortURLsuchashttp://tinyurl.com/4e9iAk.DesigntheencodeanddecodemethodsfortheTinyURLser
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode题解
-167. Two Sum II - Input array is sorted
题目:Givenanarrayofintegersthatisalreadysortedinascendingorder,findtwonumberssuchthattheyadduptoaspecifictargetnumber.ThefunctiontwoSumshouldreturnindicesofthetwonumberssuchthattheyadduptothetarget,wher
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode
leetcode题解
-123. Best Time to Buy and Sell Stock III
题目:Sayyouhaveanarrayforwhichtheithelementisthepriceofagivenstockondayi.Designanalgorithmtofindthemaximumprofit.Youmaycompleteatmosttwotransactions.Note:Youmaynotengageinmultipletransactionsatthesameti
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode题解
-696. Count Binary Substrings
从今天开始刷字符串部分的题目,这部分我会记录每一题的简短思路,方便最后写一个总结性的博客。接下来先看一下第一道题696.CountBinarySubstrings:题目:Giveastrings,countthenumberofnon-empty(contiguous)substringsthathavethesamenumberof0'sand1's,andallthe0'sandallthe1
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode题解
-94. Binary Tree Inorder Traversal
题目:Givenabinarytree,returntheinordertraversalofitsnodes’values.Forexample:Givenbinarytree[1,null,2,3],1\2/3return[1,3,2].其实题目就是要中序遍历二叉树的值。题目中也提到了,可以使用递归的方法,也可以使用遍历的方法。所以这里就讲两种方法的代码写出来即可。代码很简单,不做过多解释。递
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode题解
-560. Subarray Sum Equals K
题目:Givenanarrayofintegersandanintegerk,youneedtofindthetotalnumberofcontinuoussubarrayswhosesumequalstok.Example1:Input:nums=[1,1,1],k=2Output:2Note:Thelengthofthearrayisinrange[1,20,000].Therangeofnu
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode题解
-410. Split Array Largest Sum
题目:Givenanarraywhichconsistsofnon-negativeintegersandanintegerm,youcansplitthearrayintomnon-emptycontinuoussubarrays.Writeanalgorithmtominimizethelargestsumamongthesemsubarrays.Note:Ifnisthelengthofar
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode题解
-141. Linked List Cycle
题目:Givenalinkedlist,determineifithasacycleinit.Followup:Canyousolveitwithoutusingextraspace?上午终于把数组的题目全部都刷完了,接下来开始看链表的题目。第一道题很简单,就是判断一个链表中是否存在环。我们知道,如果一个链表中没有环,那么我们在遍历的过程中最后一个元素会指向空地址。但是如果单纯的使用遍历法,当存在
liuchongee
·
2020-06-24 06:50
leetcode刷题
leetcode
leetcode题解
-349.Intersection of Two Arrays && 350. Intersection of Two Arrays II
349.Giventwoarrays,writeafunctiontocomputetheirintersection.Example:Givennums1=[1,2,2,1],nums2=[2,2],return[2].Note:Eachelementintheresultmustbeunique.其实就是求两个数组的公共子集。思路一:使用两个HashSet,一个用于存储结果,另一个用于将其中一
liuchongee
·
2020-06-24 06:49
leetcode刷题
Leetcode题解
:Median of Two Sorted Arrays
原题:https://leetcode.com/problems/median-of-two-sorted-arrays/description/Therearetwosortedarraysnums1andnums2ofsizemandnrespectively.Findthemedianofthetwosortedarrays.Theoverallruntimecomplexityshould
AlbertSheldon
·
2020-06-24 05:19
算法
LeetCode题解
: LRU Cache 缓存设计
设计并实现最近最久未使用(LeastRecentlyUsed)缓存。链接:https://oj.leetcode.com/problems/lru-cache/题目描述:DesignandimplementadatastructureforLeastRecentlyUsed(LRU)cache.Itshouldsupportthefollowingoperations:getandset.get(
架构进化论
·
2020-06-24 03:40
面试官系列
leetcode
缓存
cache
操作系统
数据结构
LeetCode 题解 | 198.打家劫舍
LeetCode题解
|198.打家劫舍198.打家劫舍打家劫舍-力扣(LeetCode)leetcode-cn.com题目描述你是一个专业的小偷,计划偷窃沿街的房屋。
kingmax54212008
·
2020-06-24 01:49
LeetCode每日一题:3.3合并排序的数组(八十三)
合并排序的数组一、
LeetCode题解
瞧一瞧~博健的
LeetCode题解
:Gitbook版本传送门博健的
LeetCode题解
:CSDN传送门有趣的CSS:Gitbook传送门前端进阶笔记:Gitbook
余光、
·
2020-06-23 21:17
#
LeetCode题解系列
算法与数据结构+
LeetCode题解
-Js版
LeetCode题解
Js版https://webbj97.github.io/leetCode-Js/题外话
LeetCode题解
:传送门前端笔记:传送门项目背景旨在提高自己对算法的理解,将题解总结成文章
余光、
·
2020-06-23 21:44
#
LeetCode题解系列
LeetCode
前端算法
算法
数据结构
gitbook
LeetCode题解
=> 344.反转字符串(五十六)
反转字符串一、
LeetCode题解
瞧一瞧~博健的
LeetCode题解
:Gitbook版本传送门博健的
LeetCode题解
:CSDN传送门前端进阶笔记:Gitbook传送门二、算法题题目编写一个函数,其作用是将输入的字符串反转过来
余光、
·
2020-06-23 21:44
#
LeetCode题解系列
LeetCode总结
除各个题目有特殊巧妙的解法以外,大部分题目都是经典的算法或者数据结构,因此做了如下小结,具体的解题思路可以搜索我的博客:
LeetCode题解
题目算法数据结构注意事项CloneGraphBFS哈希表WordLadderIIBFS
飞起的小象
·
2020-06-23 18:25
Leetcode题解
-461. Hamming Distance
Leetcode题解
-461.HammingDistance【easy】TheHammingdistancebetweentwointegersisthenumberofpositionsatwhichthecorrespondingbitsaredifferent.Giventwointegersxandy
hzw2945
·
2020-06-23 17:21
Leetcode
[LeetCode] 037. Sudoku Solver (Hard) (C++)
索引:[LeetCode]
Leetcode题解
索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode037.SudokuSolver
hcbbt
·
2020-06-23 13:40
=====算法相关=====
+Leetcode
+基础算法
Leetcode
题解
[LeetCode] 039. Combination Sum (Medium) (C++)
索引:[LeetCode]
Leetcode题解
索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode039.CombinationSum
hcbbt
·
2020-06-23 13:40
=====算法相关=====
+基础算法
+Leetcode
leetcode
算法
C++
[LeetCode] 038. Count and Say (Easy) (C++/Python)
索引:[LeetCode]
Leetcode题解
索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode038.CountandSay
hcbbt
·
2020-06-23 13:40
+基础算法
+Leetcode
=====算法相关=====
Leetcode
题解
[leetcode] 040. Combination Sum II (Medium) (C++)
索引:[LeetCode]
Leetcode题解
索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode040.CombinationSumII
hcbbt
·
2020-06-23 13:40
=====算法相关=====
+基础算法
+Leetcode
[LeetCode] 016. 3Sum Closest (Medium) (C++/Java/Python)
索引:[LeetCode]
Leetcode题解
索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode016.3Sum_Closest
hcbbt
·
2020-06-23 13:09
+基础算法
+Leetcode
Leetcode
题解
[LeetCode] 006. ZigZag Conversion (Easy) (C++/Java/Python)
索引:[LeetCode]
Leetcode题解
索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode006.ZigZag_Conversion
hcbbt
·
2020-06-23 13:08
+基础算法
+Leetcode
=====算法相关=====
Leetcode
题解
[LeetCode] 004. Median of Two Sorted Arrays (Hard) (C++/Java/Python)
索引:[LeetCode]
Leetcode题解
索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode004.Median_of_Two_Sorted_Arrays
hcbbt
·
2020-06-23 13:08
=====算法相关=====
+Leetcode
+基础算法
Leetcode
题解
[LeetCode] 009. Palindrome Number (Easy) (C++/Java/Python)
索引:[LeetCode]
Leetcode题解
索引(C++/Java/Python/Sql)Github:https://github.com/illuz/leetcode009.Palindrome_Number
hcbbt
·
2020-06-23 13:08
=====算法相关=====
+基础算法
+Leetcode
Leetcode
题解
LeetCode题解
——83. 删除排序链表中的重复元素
题目给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。示例示例1:输入:1->1->2输出:1->2示例2:输入:1->1->2->3->3输出:1->2->3思路解决删除重复问题的一个有效的思路就是双指针法,在这题中,首指针指向第一个节点,尾指针指向与首指针值第一个不相同的节点,然后head.next=tail就可以删除其中与首指针值相同的节点了,代码如下:publicListNod
suye233
·
2020-06-23 12:56
LeetCode题解
LeetCode题解
-6. ZigZag Conversion
链接题目地址https://leetcode.com/problems/zigzag-conversion/github解题https://github.com/gatieme/LeetCode/tree/master/006-ZigZagConversionCSDN题解:http://blog.csdn.net/gatieme/article/details/50889937题目描述字符串“PA
JeanCheng
·
2020-06-23 09:14
┈┈【LeetCode
面试题】
LeetCode题解
记录——更新中
我的博客:枫之羽github源码地址:https://github.com/fengzhiyugithub/LeetCode/tree/master/Directory坚持每天更新一至两篇。向更优算法迈进~【尽量不断更】更新于:2018-11-12题目DifficultyC++JavaPython备注1.TwoSumEasyC++JavaPython两数之和2.AddTwoNumbersMediu
feng_zhiyu
·
2020-06-23 07:24
题集
LeetCode题解
汇总(C++ Java Python,含题目翻译)
更多代码请见我的github:https://github.com/lilong-dream/本文同时发布在我的个人网站,欢迎访问:http://www.lilongdream.com/2014/04/08/30.htmlLeetCode题目(含ACRates):http://oj.leetcode.com/problems/题目难度分布、面试频率及使用的数据结构与算法分析:http://blog
lilong_dream
·
2020-06-23 05:54
LeetCode
Leetcode题解
——算法思想之排序
快速选择堆1.KthElement桶排序1.出现频率最多的k个元素2.按照字符出现次数对字符串排序荷兰国旗问题1.按颜色进行排序快速选择用于求解KthElement问题,也就是第K个元素的问题。可以使用快速排序的partition()进行实现。需要先打乱数组,否则最坏情况下时间复杂度为O(N2)。堆用于求解TopKElements问题,也就是K个最小元素的问题。可以维护一个大小为K的最小堆,最小堆
dieshi8689
·
2020-06-23 04:47
LeetCode题解
(三)
LeetCode题解
(三)MergeSortedArrayGiventwosortedintegerarraysnums1andnums2,mergenums2intonums1asonesortedarray.Note
corfox_liu
·
2020-06-23 00:15
算法
【
LeetCode题解
】32. 最长有效括号
题目给定一个只包含'('和')'的字符串,找出最长的包含有效括号的子串的长度。示例1:输入:"(()"输出:2解释:最长有效括号子串为"()"示例2:输入:")()())"输出:4解释:最长有效括号子串为"()()"题解括号匹配的题,首先就是想stack的方式。我们借助stack来求解。需要定义个start变量来记录合法括号串的起始位置,我们遍历字符串,如果遇到左括号,则将当前下标压入栈,如果遇到
码蹄疾
·
2020-06-22 22:08
或许是一本可以彻底改变你刷 LeetCode 效率的题解书
经过了半年时间打磨,投入诸多人力,这本
LeetCode题解
书终于快要和大家见面了。目前已经完成了大部分章节的编写工作,预计经过一段时间的打磨就会和大家见面啦????????????????????。
fe_lucifer
·
2020-06-22 15:08
从电商数据看现在口罩价格到底如何
今天小猪不做
leetcode题解
啦,而是把视线放在一件最近很让人揪心的事情,那就是新型冠状病毒。背景小猪不是生物学生或者医学生,所以对于病毒本身的分析或者相关paper阅读真是无能为力。
fe_lucifer
·
2020-06-22 15:08
LeetCode题解
(Golang实现)--Median of Two Sorted Arrays
题目Therearetwosortedarraysnums1andnums2ofsizemandnrespectively.Findthemedianofthetwosortedarrays.TheoverallruntimecomplexityshouldbeO(log(m+n)).Example1:nums1=[1,3]nums2=[2]Themedianis2.0Example2:nums1
EvansJang
·
2020-06-22 10:49
Go语言
LeetCode
LeetCode题解
(Golang实现)--Longest Palindromic Substring
题目Givenastrings,findthelongestpalindromicsubstringins.Youmayassumethatthemaximumlengthofsis1000.Example:Input:"babad"Output:"bab"Note:"aba"isalsoavalidanswer.Example:Input:"cbbd"Output:"bb"解题思路请查看站点的解
EvansJang
·
2020-06-22 10:49
LeetCode
Leetcode题解
------Python语言实现
283classSolution(object):defmoveZeroes(self,nums):i=0zero_num=0whileitarget:high-=1else:low+=1return练习:12534434511209复杂度较高重新编写classSolution(object):defminSubArrayLen(self,s,nums):ifnotnums:return0ifma
Yasin_
·
2020-06-22 09:01
数据结构与算法
Leetcode题解
350. Intersection of Two Arrays II
Giventwoarrays,writeafunctiontocomputetheirintersection.Example:Givennums1=[1,2,2,1],nums2=[2,2],return[2,2].Note:Eachelementintheresultshouldappearasmanytimesasitshowsinbotharrays.Theresultcanbeinany
Xd_Yu
·
2020-06-22 08:50
Leetcode题解
leetcode
LeetCode 5: 最长公共子串(Longest Palindromic Substring)解法汇总
文章目录我的解法$O(n^3)$改进$O(n^2)$官方解法更多
LeetCode题解
我的解法O(n3)O(n^3)O(n3)TimeLimitExceeded,大家看看就好了,不是好的解法。
Ubuntu1996
·
2020-06-22 07:42
LeetCode刷题题解记录
leetcode题解
之反转链表II
'''反转从位置m到n的链表。请使用一趟扫描完成反转。说明:1≤m≤n≤链表长度。示例:输入:1->2->3->4->5->NULL,m=2,n=4输出:1->4->3->2->5->NULL来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/reverse-linked-list-ii著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明
QiaoRuoZhuo
·
2020-06-22 03:04
LeetCode
python
链表
Leetcode10.正则表达式匹配——动态规划之一个模型三个特征
文章目录引入“一个模型三个特征”理论
Leetcode题解
引入Leetcode中遇到了这样一道题:10.正则表达式匹配给你一个字符串s和一个字符规律p,请你来实现一个支持‘.’和‘’的正则表达式匹配。
No_Game_No_Life_
·
2020-06-22 02:42
LeetCode
LeetCode题解
:Insertion Sort List
InsertionSortListSortalinkedlistusinginsertionsort.思路:标准的插入排序。就是考察一下链表的操作而已。题解:/***Definitionforsingly-linkedlist.*structListNode{*intval;*ListNode*next;*ListNode(intx):val(x),next(NULL){}*};*/classSo
MagiSu
·
2020-06-22 01:11
数据结构和算法
LeetCode题解
:Plus One
PlusOneGivenanumberrepresentedasanarrayofdigits,plusonetothenumber.思路:关键在于计算进位。题解:classSolution{public:vectorplusOne(vector&digits){intincr=1;for(autod=digits.rbegin();d!=digits.rend();++d){*d+=incr;i
MagiSu
·
2020-06-22 01:10
数据结构和算法
LeetCode题解
:Palindrome Number
PalindromeNumberDeterminewhetheranintegerisapalindrome.Dothiswithoutextraspace.思路:题目要求只能用O(1)的空间,所以不能考虑把它转化为字符串然后reverse比较的方法。在提示中也提到了,如果考虑reversenumber的方法,可能造成溢出。那么只能选择分离数字的方法,当然要用到大量除10和取余数的计算。真是一件悲
MagiSu
·
2020-06-22 01:10
数据结构和算法
上一页
16
17
18
19
20
21
22
23
下一页
按字母分类:
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
其他