LeetCode
雨落本无晴
学而不思则罔,思而不学则殆
展开
-
LeetCode 04 两个有序数组的中位数
4.Median of Two Sorted Arrays 难度:HardThere are two sorted arraysnums1andnums2of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity shoul...原创 2019-03-14 10:20:33 · 143 阅读 · 0 评论 -
LeetCode 15 三数之和超详细(难度:Medium)
题目大意:给定一个包含n个整数的数组nums,判断nums中是否存在三个元素 *a,b,c ,*使得a + b + c =0 ?找出所有满足条件且不重复的三元组。 ...原创 2019-05-11 15:54:02 · 506 阅读 · 0 评论 -
LeetCode 17 电话号码的字母组合(难度:Medium)
题目大意:给定一个仅包含数字2-9的字符串,返回所有它能表示的字母组合。给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。Given a string containing digits from2-9inclusive, return all possible letter combinations that the number could ...原创 2019-05-15 11:18:22 · 254 阅读 · 0 评论 -
LeetCode 16 最接近的三数之和(难度:Medium)
题目大意:找nums数组中的三个数,使它们的和最接近目标值target,并且只有一组解。Given an arraynumsofnintegers and an integertarget, find three integers innumssuch that the sum is closest totarget. Return the sum of the thre...原创 2019-05-14 14:39:51 · 202 阅读 · 0 评论 -
LeetCode 13 罗马符号转化为数字(难度: Easy)
题目大意:罗马符号转化为数字Roman numerals are represented by seven different symbols:I,V,X,L,C,DandM.Symbol ValueI 1V 5X 10L 50C ...原创 2019-04-25 10:48:10 · 346 阅读 · 0 评论 -
LeetCode 14 最长公共前缀(难度:Easy)
题意大意:给出一个字符串数组,找出所有字符串的最长公共前缀。如果没有公共前缀,返回字符串 :“”Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string""....原创 2019-04-26 10:49:53 · 194 阅读 · 0 评论 -
LeetCode 12 数字转化为罗马符号(难度: Medium)
题目大意:数字转化为罗马符号Roman numerals are represented by seven different symbols:I,V,X,L,C,DandM.Symbol ValueI 1V 5X 10L 50C ...原创 2019-03-30 10:51:03 · 223 阅读 · 0 评论 -
LeetCode 11 盛最多水的容器(难度:Medium)
题目大意:给定 n 个正整数 a1,a2,…,an,其中每个点的坐标用(i, ai)表示。 画 n 条直线,使得线 i 的两个端点处于(i,ai)和(i,0)处。请找出其中的两条直线,使得他们与 X 轴形成的容器能够装最多的水。注意:你不能倾斜容器,n 至少是2。Givennnon-negative integersa1,a2, ...,an, where each ...原创 2019-03-23 09:56:31 · 186 阅读 · 0 评论 -
LeetCode 06 模拟 Z 字型字符串转换
6.ZigZag Conversion 难度:MediumThe string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better ...原创 2019-03-19 10:58:55 · 313 阅读 · 0 评论 -
LeetCode 05 最长回文子串 暴力破解和动态规划
5.Longest Palindromic Substring 难度:MediumGiven a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000.Example 1:Input: "babad"Outpu...原创 2019-03-18 15:51:51 · 787 阅读 · 0 评论 -
LeetCode 03 最长无重复字符的子串
3. Longest Substring Without Repeating Characters 难度:MediumGiven a string, find the length of thelongest substringwithout repeating characters.Example 1:Input: "abcabcbb"Output: 3 Exp...原创 2019-03-13 14:30:42 · 135 阅读 · 0 评论 -
LeetCode 02 两个数字相加
2. Add Two Numbers 难度:MediumYou are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse orderand each of their nodes contain a single dig...原创 2019-03-13 12:33:08 · 118 阅读 · 0 评论 -
LeetCode 01 两数之和
1. Two Sum 难度:EasyGiven an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and yo...原创 2019-03-13 11:41:26 · 122 阅读 · 0 评论 -
LeetCode 10 正则表达式匹配(难度:Hard)
题意:正则表达式匹配Given an input string (s) and a pattern (p), implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the prec...原创 2019-03-21 10:58:43 · 271 阅读 · 0 评论 -
LeetCode 09 判断回文数字(难度:Easy)
题目大意:判断一个数字是不是回文数字Determine whether an integer is a palindrome. An integerisapalindrome when itreads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: ...原创 2019-03-20 13:15:56 · 202 阅读 · 0 评论 -
LeetCode 08 字符串转换为数字(难度:Medium)
题目大意:字符串转换为数字Implementatoiwhichconverts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then,...原创 2019-03-20 11:30:44 · 300 阅读 · 0 评论 -
LeetCode 07 翻转整数(难度: Easy)
题目大意:翻转整数 Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21题意: 给...原创 2019-03-20 10:20:42 · 186 阅读 · 0 评论 -
LeetCode 18 四数之和(难度:Medium)
题目大意:给定一个包含n个整数的数组nums和一个目标值target,判断nums中是否存在四个元素a,b,c和d,使得a+b+c+d的值与target相等?找出所有满足条件且不重复的四元组。注意:答案中不可以包含重复的四元组。Given an arraynumsofnintegers and an integertarget, are...原创 2019-05-17 11:02:33 · 197 阅读 · 0 评论