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刷题
记录--Reverse String
题目难度:easyWriteafunctionthattakesastringasinputandreturnsthestringreversed.Example:Givens="hello",return"olleh".第一次解法/***@param{string}s*@return{string}*/varreverseString=function(s){letl=s.lengthletre
fishliu
·
2020-04-04 19:12
算法学习——求最长无重复子串
LeetCode刷题
:3.无重复字符的最长子串题目要求如下:给定一个字符串,请你找出其中不含有重复字符的最长子串的长度。
松花江以南
·
2020-04-04 16:35
当我在刷题的时候,到底在干些什么(扯淡文)
最近为了准备笔试,每天总会抽出点打游戏的时间刷刷
leetcode刷题
嘛,无非就是看着题目楞想,每种思路试一试,试不出来看提示,还不行看别人的答案然后学思路再换种语言默写一遍。
thehgz
·
2020-04-04 06:01
LeetCode 42. 接雨水
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode42
图灵的图,图灵的灵。
·
2020-04-04 00:00
LeetCode 36. 有效的数独
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode36
图灵的图,图灵的灵。
·
2020-04-03 23:00
LeetCode 8. 字符串转换整数 (atoi)
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode8
图灵的图,图灵的灵。
·
2020-04-03 20:00
Leetcode刷题
笔记 - 《剑指Offer》面试题06 - 从头到尾打印链表
从尾到头打印链表输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。示例1:输入:head=[1,3,2]输出:[2,3,1]限制:0reversePrint(ListNode*head){12vectorlist;13ListNode*p=head;14while(p!=NULL){15list.push_back(p->val);//将每个链表节点的值都存在数组中16p=p->
李橙皮er
·
2020-04-03 16:00
leetcode刷题
记录--Find Anagram Mappings
题目难度:easyGiventwolistsAandB,andBisananagramofA.BisananagramofAmeansBismadebyrandomizingtheorderoftheelementsinA.WewanttofindanindexmappingP,fromAtoB.AmappingP[i]=jmeanstheithelementinAappearsinBatinde
fishliu
·
2020-04-03 09:04
LeetCode 289. 生命游戏
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode289
图灵的图,图灵的灵。
·
2020-04-02 17:00
LeetCode 1111. 有效括号的嵌套深度
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode1111
图灵的图,图灵的灵。
·
2020-04-01 23:00
LeetCode 337. 打家劫舍 III
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode337
图灵的图,图灵的灵。
·
2020-03-31 14:00
LeetCode 912. 排序数组
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode912
图灵的图,图灵的灵。
·
2020-03-31 12:00
LeetCode 面试题62. 圆圈中最后剩下的数字
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode
图灵的图,图灵的灵。
·
2020-03-30 22:00
LeetCode 1162. 地图分析
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode1162
图灵的图,图灵的灵。
·
2020-03-29 23:00
LeetCode刷题
--DFS与BFS --岛屿的最大面积与地图分析
题目均来自于力扣,最近力扣正在举行每日一题的活动,有兴趣的小伙伴可以多参与哦。先来看看岛屿的最大面积的题目描述吧。给定一个包含了一些0和1的非空二维数组grid。一个岛屿是由一些相邻的1(代表土地)构成的组合,这里的「相邻」要求两个1必须在水平或者竖直方向上相邻。你可以假设grid的四个边缘都被0(代表水)包围着。找到给定的二维数组中最大的岛屿面积。(如果没有岛屿,则返回面积为0。)示例1:[[0
DogTwo
·
2020-03-29 22:00
LeetCode 820. 单词的压缩编码
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode820
图灵的图,图灵的灵。
·
2020-03-29 21:00
LeetCode刷题
笔记 820. 单词的压缩编码 【反转+排序】【字典树】
反转+排序无需字典树,轻轻一反转,结果就出来(C++/Java/Python)classSolution{public:intminimumLengthEncoding(vector&words){intn=words.size();vectorreversed_words;for(stringword:words){/反转每个单词reverse(word.begin(),word.end());
三重极简
·
2020-03-28 18:55
Leetcode
LeetCode 914. 卡牌分组
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode914
图灵的图,图灵的灵。
·
2020-03-27 14:00
leetcode刷题
指南
56.MergeIntervals链接https://leetcode.com/problems/merge-intervals/#Array,#Sort,#Medium思路先排序,然后挨个看后一个点的begin是不是比当前hold的那个range的end要小,如果小的话就修改当前range的end,否则就开一个新的range。代码/***Definitionforaninterval.*publ
暴躁的伊泽瑞尔
·
2020-03-27 02:20
2019-10-17
leetcode刷题
总结 BST
BinarySearchTreetoGreaterSumTree根据题目给出的例子,相当于要做一个reversesort,由于得到sortedarray的是inordertraversal,就把inordersort反过来实现。/***Definitionforabinarytreenode.*publicclassTreeNode{*intval;*TreeNodeleft;*TreeNoder
Leahlijuan
·
2020-03-26 14:49
LeetCode 999. 车的可用捕获量
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode999
图灵的图,图灵的灵。
·
2020-03-26 13:00
搜索插入位置-----
leetcode刷题
(python解题)
[TOC]题目给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。你可以假设数组中无重复元素。示例1:输入:[1,3,5,6],5输出:2示例2:输入:[1,3,5,6],2输出:1示例3:输入:[1,3,5,6],7输出:4示例4:输入:[1,3,5,6],0输出:0来源:力扣(LeetCode)链接:https://leetc
执笔人
·
2020-03-26 09:15
python那些事
leetcode
python
LeetCode刷题
指南(数组和矩阵)
CYC2018LeetCode题解是CYC2018的力作,我也是通过他的题解来完成算法刷题的,这里也准备和大家分享他的LeetCode题解,于是我结合自己在进行刷题时做的分析和理解,按照题目类型进行划分,形成本系列的
LeetCode
程序员黄小斜
·
2020-03-25 21:47
LeetCode 892. 三维形体的表面积
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode892
图灵的图,图灵的灵。
·
2020-03-25 16:00
LeetCode 213. 打家劫舍 II
我的LeetCode:https://leetcode-cn.com/u/ituring/我的
LeetCode刷题
源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode213
图灵的图,图灵的灵。
·
2020-03-24 21:00
leetcode刷题
(16)——21.合并两个有序链表
一、题目将两个升序链表合并为一个新的升序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。示例:输入:1->2->4,1->3->4输出:1->1->2->3->4->4二、思路及代码实现方法一:迭代(1)若l1、l2中有一个为空,则返回另一个链表,即为合并的结果。(2)若l1、l2都不为空,比较l1和l2的值。若l1的值小于l2的值,则将l1添加至合并的链表,并将l1的指针后移一个;否
TheManba
·
2020-03-24 17:30
leetcode刷题
链表
leetcode
java
js +
leetcode刷题
:No.198、213、337打家劫舍三题一文
leetcode198与面试题17.16.按摩师一样,而打家劫舍系列共有三道题目,还有两个分别是213,337一、198题目:打家劫舍你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。给定一个代表每个房屋存放金额的非负整数数组,计算你在不触动警报装置的情况下,能够偷
小确信(「・ω・)「嘿
·
2020-03-24 16:36
leetcode_js刷题
leetcode
动态规划
打家劫舍
javascript
算法学习笔记之初级字符串(6.3 两题)
LeetCode刷题
总结1.有效的字母异位词给定两个字符串s和t,编写一个函数来判断t是否是s的一个字母异位词。
芝士和饼干
·
2020-03-23 07:48
LeetCode刷题
系列之Median of Two Sorted Arrays
DescriptionTherearetwosortedarraysnums1andnums2ofsizemandnrespectively.Findthemedianofthetwosortedarrays.TheoverallruntimecomplexityshouldbeO(log(m+n)).Example1:nums1=[1,3]nums2=[2]Themedianis2.0Examp
溜达溜达就老了
·
2020-03-22 17:47
leetcode刷题
记录--Self Dividing Numbers
题目难度:easyAself-dividingnumberisanumberthatisdivisiblebyeverydigititcontains.Forexample,128isaself-dividingnumberbecause128%1==0,128%2==0,and128%8==0.Also,aself-dividingnumberisnotallowedtocontainthedi
fishliu
·
2020-03-20 05:36
js +
leetcode刷题
:No.34 在排序数组中查找元素的第一个和最后一个位置
题目:给定一个按照升序排列的整数数组nums,和一个目标值target。找出给定目标值在数组中的开始位置和结束位置。你的算法时间复杂度必须是O(logn)级别。如果数组中不存在目标值,返回[-1,-1]。解法:快速找出左右边界//解法1varsearchRange=function(nums,target){letres=[-1,-1],len=nums.length,left=0,right=l
小确信(「・ω・)「嘿
·
2020-03-19 14:00
leetcode_js刷题
leetcode
算法
JavaScript
二分法
LeetCode刷题
笔记 409. 最长回文串 【哈希表】【数组保存】
哈希表最长回文串classSolution{public:intlongestPalindrome(strings){unordered_mapcount;intans=0;for(charc:s)++count[c];for(autop:count){intv=p.second;ans+=v/2*2;/发现了第一个出现次数为奇数的字符后,我们将ans增加1,这样ans变为奇数,/在后面发现其它出
三重极简
·
2020-03-19 10:37
Leetcode
Python 实现
LeetCode刷题
之无重复字符的最长子串
classSolution(object):defLengthOfLongestSubstring(self,s):d={}start=0ans=0fori,cinenumerate(s):ifcind:start=max(start,d[c]+1)d[c]=ians=max(ans,i-start+1)returnansif__name__=='__main__':s='pwwkew'a=Sol
John的IT之旅
·
2020-03-18 15:58
python
LeetCode刷题
笔记 836. 矩形重叠 【二维->一维投影】
图解:将矩形重叠问题转化为区间重叠问题(C++/Java/Python)boolisRectangleOverlap(vector&rec1,vector&rec2){boolx_overlap=!(rec1[2]<=rec2[0]||rec2[2]<=rec1[0]);booly_overlap=!(rec1[3]<=rec2[1]||rec2[3]<=rec1[1]);returnx_over
三重极简
·
2020-03-18 10:11
LeetCode刷题
笔记 1160. 拼写单词 【统计】【哈希表】
暴力解法classSolution{public:intcountCharacters(vector&words,stringchars){intnum=words.size();intres=0;for(inti=0;icount(string&word){vectorcounter(26,0);for(charc:word){counter[c-'a']++;}returncounter;}/
三重极简
·
2020-03-17 15:20
Leetcode
LeetCode刷题
之路 反转字符串中的元音字母
反转字符串中的元音字母【简单】编写一个函数,以字符串作为输入,反转该字符串中的元音字母。示例1:输入:"hello"输出:"holle"示例2:输入:"leetcode"输出:"leotcede"说明:元音字母不包含字母"y"。解题思路这道题是让我们反转字符串中的元音字母,但是没说大小写,所以元音字母总共包括aeiouAEIOU这些,我们作为字符串存储。然后我们创建两个队列分别存储给定字符串的元音
墨酌
·
2020-03-16 19:37
Leetcode刷题
笔记 - 《剑指Offer》面试题05 - 替换空格
替换空格请实现一个函数,把字符串s中的每个空格替换成"%20"。示例1:输入:s="Wearehappy."输出:"We%20are%20happy."限制:0<=s的长度<=10000我的思路:用find函数找到空格在字符串中的位置,再用replace函数将空格替换为“20%”。C++代码如下:classSolution{public:stringreplaceSpace(strings){wh
李橙皮er
·
2020-03-12 18:00
Leetcode刷题
笔记 - 《剑指Offer》面试题04 - 二维数组中的查找
二维数组中的查找在一个n*m的二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。示例:现有矩阵matrix如下:[[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24],[18,21,23,26,30]]给定target=5,返
李橙皮er
·
2020-03-12 17:00
Leetcode刷题
笔记 - 《剑指Offer》面试题03 - 数组中重复的数字
找出数组中重复的数字。在一个长度为n的数组nums里的所有数字都在0~n-1的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。示例1:输入:[2,3,1,0,2,5,3]输出:2或3限制:2&nums){4inti,temp;5intn=nums.size();6for(i=0;i
李橙皮er
·
2020-03-12 17:00
leetcode刷题
628. 三个数的最大乘积
题目描述:给定一个整型数组,在数组中找出由三个数组成的最大乘积,并输出这个乘积。示例1:输入:[1,2,3]输出:6示例2:输入:[1,2,3,4]输出:24注意:给定的整型数组长度范围是[3,104],数组中所有的元素范围是[-1000,1000]。输入的数组中任意三个数的乘积不会超出32位有符号整数的范围。来源:力扣(LeetCode)链接:https://leetcode-cn.com/pr
星星光点
·
2020-03-12 16:45
C++
leetCode刷题
LeetCode刷题
之无重复字符的最长子串
LeetCode刷题
之无重复字符的最长子串无重复字符的最长子串(LongestSubstringWithoutRepeatingCharacters)题目代码官方解法方法一:暴力法方法二:滑动窗口方法三
Charles Yan
·
2020-03-11 22:02
LeetCode
算法
【
LeetCode刷题
-简单】155. 最小栈(python c++)
题目设计一个支持push,pop,top操作,并能在常数时间内检索到最小元素的栈。push(x)--将元素x推入栈中。pop()--删除栈顶的元素。top()--获取栈顶元素。getMin()--检索栈中的最小元素。示例:MinStackminStack=newMinStack();minStack.push(-2);minStack.push(0);minStack.push(-3);minSt
404TATTOO
·
2020-03-11 15:13
LeetCode刷题
leetcode刷题
记录--Judge Route Circle
题目难度:easyInitially,thereisaRobotatposition(0,0).Givenasequenceofitsmoves,judgeifthisrobotmakesacircle,whichmeansitmovesbacktotheoriginalplace.Themovesequenceisrepresentedbyastring.Andeachmoveisreprese
fishliu
·
2020-03-11 05:26
java 刷题感受
java刷题基础知识写在前面lintcode与
leetcode刷题
的好处:只关心功能的实现,不用处理相应的输入和输出。
bradyjoestar
·
2020-03-10 10:35
LeetCode刷题
笔记 292. Nim 游戏 【智力题】【动态规划】
动态规划超时思路可以有哈classSolution{public:boolcanWinNim(intn){vectordp(n+1);for(inti=0;i<4;i++)dp[i]=true;for(inti=4;i<=n;i++)dp[i]=!(dp[i-1]&&dp[i-2]&&dp[i-3]);returndp[n];}};一行本质解题如果能被4整除,我们肯定会输如4、8、12、…无论我们
三重极简
·
2020-03-09 11:24
Leetcode
LeetCode刷题
之Remove Duplicates from Sorted List II
ProblemGivenasortedlinkedlist,deleteallnodesthathaveduplicatenumbers,leavingonlydistinctnumbersfromtheoriginallist.Forexample,Given1->2->3->3->4->4->5,return1->2->5.Given1->1->1->2->3,return2->3.MySol
JRTx
·
2020-03-08 14:30
LeetCode刷题
笔记 146. LRU缓存机制 【哈希表+双向链表】
LeetCode刷题
笔记146.LRU缓存机制完整版简化版LRU策略详解和实现完整版classLRUCache{private:intcap;//双链表:装着(key,value)元组list>cache
三重极简
·
2020-03-07 17:06
Leetcode
算法-
leetcode刷题
[toc]LeetCode.1两数之和给定一个整数数组nums和一个目标值target,请你在该数组中找出和为目标值的那两个整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。classSolution{publicint[]twoSum(int[]nums,inttarget){int[]result=newint[2];////双重循环时间
tylorsenna
·
2020-03-06 17:29
LeetCode刷题
笔记 62. 不同路径 【动态规划】
动态规划基础时间复杂度:O(m∗n)O(m*n)O(m∗n)空间复杂度:O(m∗n)O(m*n)O(m∗n)classSolution{public:intuniquePaths(intm,intn){vector>dp(m,vector(n));for(inti=0;i>cur[j]=pre[j]+cur[j-1],因此空间复杂度为O(n).优化1:空间复杂度O(2n)classSolution
三重极简
·
2020-03-06 15:36
Leetcode
LeetCode刷题
笔记 46. 全排列 78. 子集 【回溯算法模板】
LeetCode刷题
笔记46.全排列46.全排列78.子集流程打印46.全排列回溯算法详解defbacktrack(...)
三重极简
·
2020-03-06 10:57
Leetcode
上一页
101
102
103
104
105
106
107
108
下一页
按字母分类:
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
其他