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-
第十四题:Longest Common Prefix
题目题目题目分析题目的意思是在一个字符串数组中,找出这些字符串拥有的最长的公共前缀子串,如“ab”,“abc”,“abd”最长的公共前缀子串是“ab”.思路:采用动态的方法,首先找出任意两个字符串的最长前缀公共子串,然后再用该最长字符串去和剩余的字符串进行找最长公共子串的操作。如“ab”,“abc”,“abd”,“aef”:首先找到“ab”和“abc”的最长公共前缀字符串是“ab”,再用“ab”和
baixiaoshuai
·
2017-05-20 11:21
Leetcode-
标签为Tree 543. Diameter of Binary Tree
原题Givenabinarytree,youneedtocomputethelengthofthediameterofthetree.Thediameterofabinarytreeisthelengthofthelongestpathbetweenanytwonodesinatree.Thispathmayormaynotpassthroughtheroot.Example:Givenabina
zg1g
·
2017-04-23 10:50
算法/LeetCode
经典算法
LeetCode题目研究
leetcode
二叉树
Leetcode-
标签为Tree 110. Balanced Binary Tree
原题Givenabinarytree,determineifitisheight-balanced.Forthisproblem,aheight-balancedbinarytreeisdefinedasabinarytreeinwhichthedepthofthetwosubtreesofeverynodeneverdifferbymorethan1.题目分析判断二叉树是否为平衡二叉树。代码实现
alg-flody
·
2017-04-23 09:57
算法/LeetCode
经典算法
LeetCode题目研究
Leetcode-
标签为Tree的easy题目列表
编号题目通过率程度107BinaryTreeLevelOrderTraversalII39.0%Easy257BinaryTreePaths36.8%Easy501FindModeinBinarySearchTree38.4%Easy437PathSumIII39.3%Easy404SumofLeftLeaves46.5%Easy112PathSum33.5%Easy110BalancedBina
alg-flody
·
2017-04-20 08:56
算法/LeetCode
经典算法
LeetCode题目研究
Leetcode-
标签为stack 155. Min Stack
原题题目分析设计栈,并在常数时间复杂度求栈的最小元素。内部维护一个列表实现栈的功能。代码实现publicclassMinStack{privateList_list;privateint_min;/**initializeyourdatastructurehere.*/publicMinStack(){_list=newList();}publicvoidPush(intx){_list.Add(
alg-flody
·
2017-04-15 17:58
算法/LeetCode
经典算法
LeetCode题目研究
FCC
初级算法
题solution
1.ReverseaString/*1.分割数组2.反转数组3.将数组链接成字符串*/functionreverseString(str){returnstr.split('').reverse().join('');}console.log(reverseString("helloworld,howareyou?"));2.FactorializeaNumber/*将小于此数的所用数用for循环
董懂同学
·
2017-04-01 10:36
LeetCode-
连续子数组的最大和
Findthecontiguoussubarraywithinanarray(containingatleastonenumber)whichhasthelargestsum.Forexample,giventhearray[−2,1,−3,4,−1,2,1,−5,4],thecontiguoussubarray[4,−1,2,1]hasthelargestsum=6.clicktoshowmor
ivolcano
·
2017-03-10 00:00
编程
FreeCodeCamp-JavaScript
初级算法
题
FCC:GitHub-FreeCodeCamp/FreeCodeCamp:Thehttps://FreeCodeCamp.comopensourcecodebaseandcurriculum.Learntocodeandhelpnonprofits.期初我觉得FCC只是一个供新手学习和进阶的“闯关游戏”,但是现在觉得,里面“关卡”的设置真是的“niubility”,帮助我理清了许多学习思路。这里主
不要吧我再睡会
·
2017-01-05 11:40
LeetCode-
第八题:String to Integer
题目leetCode.png分析完整代码#include#include#includeintmyAtoi(char*str);intmain(){charstr[12]="2147483648";printf("int_max=%d,%d\n",INT_MAX,myAtoi(str));return0;}intmyAtoi(char*str){if(str==NULL){return0;}lon
baixiaoshuai
·
2016-10-29 15:59
Leetcode-
第22题:Generate Parentheses
题目:Givennpairsofparentheses,writeafunctiontogenerateallcombinationsofwell-formedparentheses.Forexample,givenn=3,asolutionsetis:"((()))","(()())","(())()","()(())","()()()"分析:对于一个给定的n,有效的括号必定包括n个'('和n个
八刀一闪
·
2016-09-24 16:29
LeetCode-
做题简记
2016年夏天开始,跟着学校的一个leetcode群每天做一题。下面记录下过程中没来得及做的,或者没做好的,或者个人觉得得留意下的题目,以备更好的回顾。菜鸟一个~未做的题目(有空补上):112.PathSum241.DifferentWaystoAddParentheses3.LongestSubstringWithoutRepeatingCharacters没做好的题目:CountofRange
i-Blue
·
2016-09-22 20:49
LeetCode
C/C++
c++
leetcode
leetcode-
【hard】4. Median of Two Sorted Arrays
题目Therearetwosortedarrays nums1 and nums2 ofsizemandnrespectively.Findthemedianofthetwosortedarrays.TheoverallruntimecomplexityshouldbeO(log(m+n)).Example1:nums1=[1,3] nums2=[2] Themedianis2.0 E
Shirlies
·
2016-08-10 15:00
leetcode-
【中等题】5. Longest Palindromic Substring
题目Givenastring S,findthelongestpalindromicsubstringin S.Youmayassumethatthemaximumlengthof S is1000,andthereexistsoneuniquelongestpalindromicsubstring.答案一道动规题目,每次用当前位置columnIndex跟前面位置rowIndex去比较时,如果相同
Shirlies
·
2016-08-08 15:00
leetcode-
刷题经验
以下内容来自本人在一亩三分地论坛上开帖得到的回复。既然慢就多思考优化呀。。。通常有以下思路(临时总结,仅供参考):*1.找性能瓶颈。比如排序是nlogn最耗时,有没有办法不排序直接得到答案?比如twosum,不排序,直接上hashmap2.优化代码。有挺多种情况(1)有没有多余的操作?比如不必要的copy(2)递归能不能换迭代?在递归的overhead比较高的时候,提升会明显一些(3)有没有可能剪
coder_growth
·
2016-08-06 08:56
leetcode
leetcode-
【中等题】3. Longest Substring Without Repeating Characters
题目:Givenastring,findthelengthofthe longestsubstring withoutrepeatingcharacters.Examples:Given "abcabcbb",theansweris "abc",whichthelengthis3.Given "bbbbb",theansweris "b",withthelengthof1.Given "pwwke
Shirlies
·
2016-08-04 14:00
leetcode-
【中等题】2. Add Two Numbers
题目Youaregiventwolinkedlistsrepresentingtwonon-negativenumbers.Thedigitsarestoredinreverseorderandeachoftheirnodescontainasingledigit.Addthetwonumbersandreturnitasalinkedlist.Input: (2->4->3)+(5->6->4)
Shirlies
·
2016-07-20 20:00
leetcode-
【中等题】228. Summary Ranges
题目:228.SummaryRangesGivenasortedintegerarraywithoutduplicates,returnthesummaryofitsranges.Forexample,given [0,1,2,4,5,7],return ["0->2","4->5","7"].答案:就是找连续的序列。直接判断相邻数据大小是否相差为1即可,主要是注意最后的数字要特殊考虑一下。链接:
Shirlies
·
2016-07-16 15:00
leetcode-
【hard】273. Integer to English Words
题目:273.IntegertoEnglishWordsConvertanon-negativeintegertoitsenglishwordsrepresentation.Giveninputisguaranteedtobelessthan231 -1.Forexample,123->"OneHundredTwentyThree" 12345->"TwelveThousandThreeHund
Shirlies
·
2016-07-16 13:00
leetcode-
【简单题】Happy Number
题目:Writeanalgorithmtodetermineifanumberis"happy".Ahappynumberisanumberdefinedbythefollowingprocess:Startingwithanypositiveinteger,replacethenumberbythesumofthesquaresofitsdigits,andrepeattheprocessunt
Shirlies
·
2016-07-11 09:00
leetcode-
【中等题】Divide Two Integers
题目Dividetwointegerswithoutusingmultiplication,divisionandmodoperator.Ifitisoverflow,returnMAX_INT链接https://leetcode.com/problems/divide-two-integers/答案1、int的最大值MAX_INT为power(2,31)-1=21474836472、int的最小
Shirlies
·
2016-07-09 13:00
LeetCode-
238. Product of Array Except Self
Problem:Givenanarrayofnintegerswheren>1,nums,returnanarrayoutputsuchthatoutput[i]isequaltotheproductofalltheelementsofnumsexceptnums[i].SolveitwithoutdivisionandinO(n).Forexample,given[1,2,3,4],return
u010305706
·
2016-05-17 20:00
LeetCode
Leetcode-
关于二叉树的对称性
二叉树的镜像对称问题,是一个easy的题/** *Definitionforabinarytreenode. *structTreeNode{ *intval; *TreeNode*left; *TreeNode*right; *TreeNode(intx):val(x),left(NULL),right(NULL){} *}; */ classSolution{ public: boolisSy
sinat_27935693
·
2016-04-14 20:00
leetcode-
构造二叉树
1.由前序遍历和中序遍历构造二叉树/** *Definitionforabinarytreenode. *structTreeNode{ *intval; *TreeNode*left; *TreeNode*right; *TreeNode(intx):val(x),left(NULL),right(NULL){} *}; */ classSolution{ public: TreeNode*bu
sinat_27935693
·
2016-04-13 19:00
LeetCode-
算法总结
Array:矩阵;HashTable:哈希;LinkedList:链表;Math:数学;TwoPointers:双指针;Sting:字符串;DivideandConquer:分治;BinarySearch:二分;DynamicProgramming:动态规划;Backtracking:回溯;+++++++++++++Stack:堆栈;Heap:队列;Greedy:贪心;Sort:排序;BitMan
EddyLiu-csdn
·
2016-01-16 22:11
LeetCode
leetcode-
Range Sum Query - Immutable
https://leetcode.com/problems/range-sum-query-immutable/很简单的dp题目。需要一看就立马会。
xyqzki
·
2015-12-02 15:00
LeetCode-
Two Sum
题目描述:Givenanarrayofintegers,findtwonumberssuchthattheyadduptoaspecifictargetnumber.ThefunctiontwoSumshouldreturnindicesofthetwonumberssuchthattheyadduptothetarget,whereindex1mustbelessthanindex2.Pleas
csharp25
·
2015-12-02 10:00
leetcode-
First Bad Version---简单
https://leetcode.com/problems/first-bad-version/binarysearchmycode:#TheisBadVersionAPIisalreadydefinedforyou. #@paramversion,aninteger #@returnabool #defisBadVersion(version): classSolution(object):
xyqzki
·
2015-12-01 21:00
leetcode-
Given a sorted integer array without dup
Givenasortedintegerarraywithoutduplicates,returnthesummaryofitsranges.Forexample,given [0,1,2,4,5,7],return ["0->2","4->5","7"].class Solution { public: vector
summaryRanges(vector
& n
thoresa
·
2015-11-08 14:00
leetcode-
Search for a Range
Givenasortedarrayofintegers,findthestartingandendingpositionofagiventargetvalue.Youralgorithm'sruntimecomplexitymustbeintheorderof O(log n).Ifthetargetisnotfoundinthearray,return [-1,-1].Forexample,Gi
thoresa
·
2015-11-07 23:00
leetcode-
Sqrt(x)
Implement intsqrt(intx).Computeandreturnthesquarerootof x.class Solution { public: int mySqrt(int x) { if(x<=0) return 0; int begin=1, end=x, mid=0, res=0, tmp=0; while(beg
thoresa
·
2015-11-07 23:00
leetcode-
Single Number
Givenanarrayofintegers,everyelementappears twice exceptforone.Findthatsingleone.Note:Youralgorithmshouldhavealinearruntimecomplexity.Couldyouimplementitwithoutusingextramemory?Subscribe toseewhichcomp
thoresa
·
2015-11-07 23:00
leetcode-
Linked List Cycle
Givenalinkedlist,determineifithasacycleinit.Followup:Canyousolveitwithoutusingextraspace?/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * Li
thoresa
·
2015-11-07 23:00
leetcode-
Longest Common Prefix
Writeafunctiontofindthelongestcommonprefixstringamongstanarrayofstrings.classSolution{ intmaxCountLength(string&a,string&b,intminLength){//返回两个字符串的前缀长度,minLength表示上一次比较结果的前缀长度 intcount=0; for(inti=0,j
ljlstart
·
2015-11-02 23:00
一个交换程序的通用版本
Author:bakari Date:2012.9.3 交换程序是每个开始学习编程的人必学习的一个
初级算法
。
·
2015-11-02 12:45
程序
Arichmetic-算法解析和面试经常出的算法题大总结
写此博文一是做个终结,迈过
初级算法
员,向中级算法员挺进;二是希望能结识更多热爱算法的童鞋,相互提携,一起进步。
·
2015-10-31 09:58
chm
【
LeetCode-
面试算法经典-Java实现】【226-Invert Binary Tree(反转二叉树)】
【226-InvertBinaryTree(反转二叉树)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao】
derrantcm
·
2015-08-30 06:34
LeetCode
LeetCode
【
LeetCode-
面试算法经典-Java实现】【226-Invert Binary Tree(反转二叉树)】
【226-InvertBinaryTree(反转二叉树)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao】
DERRANTCM
·
2015-08-30 06:00
算法
面试
二叉树
反转
【
LeetCode-
面试算法经典-Java实现】【226-Invert Binary Tree(反转二叉树)】
【226-InvertBinaryTree(反转二叉树)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao】
DERRANTCM
·
2015-08-30 06:00
算法
面试
二叉树
反转
【
LeetCode-
面试算法经典-Java实现】【225-Implement Stack using Queues(用队列实现栈操作)】
【225-ImplementStackusingQueues(用队列实现栈操作)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
derrantcm
·
2015-08-29 06:41
LeetCode
LeetCode
【
LeetCode-
面试算法经典-Java实现】【225-Implement Stack using Queues(用队列实现栈操作)】
【225-ImplementStackusingQueues(用队列实现栈操作)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
DERRANTCM
·
2015-08-29 06:00
java
算法
面试
栈
队列
【
LeetCode-
面试算法经典-Java实现】【223-Rectangle Area(矩形区域)】
【223-RectangleArea(矩形区域)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao】原题Findthetotalareacoveredbytworectilinearrectanglesina2Dplane.Eachrectangleisdefinedbyitsbottomleftcorn
derrantcm
·
2015-08-29 06:48
LeetCode
LeetCode
【
LeetCode-
面试算法经典-Java实现】【223-Rectangle Area(矩形区域)】
【223-RectangleArea(矩形区域)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao】原题Findthetotalareacoveredbytworectilinearrectanglesina2Dplane.Eachrectangleisdefinedbyitsbottomleftcorn
DERRANTCM
·
2015-08-29 06:00
java
算法
面试
矩形
【
LeetCode-
面试算法经典-Java实现】【223-Rectangle Area(矩形区域)】
【223-RectangleArea(矩形区域)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao】原题Findthetotalareacoveredbytworectilinearrectanglesina2Dplane.Eachrectangleisdefinedbyitsbottomleftcorn
DERRANTCM
·
2015-08-29 06:00
java
算法
面试
矩形
【
LeetCode-
面试算法经典-Java实现】【219-Contains Duplicate II(包含重复元素II)】
【219-ContainsDuplicateII(包含重复元素II)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
derrantcm
·
2015-08-29 06:21
LeetCode
LeetCode
【
LeetCode-
面试算法经典-Java实现】【219-Contains Duplicate II(包含重复元素II)】
【219-ContainsDuplicateII(包含重复元素II)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
DERRANTCM
·
2015-08-29 06:00
java
算法
面试
重复元素
【
LeetCode-
面试算法经典-Java实现】【219-Contains Duplicate II(包含重复元素II)】
【219-ContainsDuplicateII(包含重复元素II)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
DERRANTCM
·
2015-08-29 06:00
java
算法
面试
重复元素
【
LeetCode-
面试算法经典-Java实现】【217-Contains Duplicate(包含重复元素)】
【217-ContainsDuplicate(包含重复元素)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
derrantcm
·
2015-08-28 07:49
LeetCode
LeetCode
【
LeetCode-
面试算法经典-Java实现】【217-Contains Duplicate(包含重复元素)】
【217-ContainsDuplicate(包含重复元素)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
DERRANTCM
·
2015-08-28 07:00
java
算法
面试
重复元素
【
LeetCode-
面试算法经典-Java实现】【217-Contains Duplicate(包含重复元素)】
【217-ContainsDuplicate(包含重复元素)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
DERRANTCM
·
2015-08-28 07:00
java
算法
面试
重复元素
【
LeetCode-
面试算法经典-Java实现】【216-Combination Sum III (组合数的和)】
【216-CombinationSumIII(组合数的和)】【
LeetCode-
面试算法经典-Java实现】【所有题目目录索引】代码下载【https://github.com/Wang-Jun-Chao
derrantcm
·
2015-08-28 06:38
LeetCode
LeetCode
上一页
43
44
45
46
47
48
49
50
下一页
按字母分类:
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
其他