
LeetCode
程序员啊粥
比你优秀的人比你还努力,你有什么资格不去奋斗!
展开
-
【LeetCode题解---1】Two Sum.md
【LeetCode题解—1】Two Sum题目Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, an...原创 2018-09-25 18:22:19 · 512 阅读 · 0 评论 -
【LeetCode - 016】最接近的三数之和
最接近的三数之和题目Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would ...转载 2018-12-01 20:31:18 · 212 阅读 · 0 评论 -
【LeetCode - 015】三数之和
三数之和题目Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b...原创 2018-12-01 20:29:22 · 214 阅读 · 0 评论 -
【LeetCode-012】Integer to Roman
题目Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...原创 2018-11-07 23:55:28 · 138 阅读 · 0 评论 -
【011】Container With Most Water
题目Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find tw...原创 2018-11-03 21:48:02 · 188 阅读 · 0 评论 -
【010】Regular Expression Matching
题目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 preceding element....原创 2018-11-03 21:31:36 · 247 阅读 · 0 评论 -
【191】Number of 1 bits
题目Write a function that takes an unsigned integer and returns the number of ‘1’ bits it has (also known as the Hamming weight).Example 1:Input: 11Output: 3Explanation: Integer 11 has binary repre...原创 2018-10-21 09:57:30 · 217 阅读 · 0 评论 -
LeetCode【009】Palindrome Number
题目Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplana...原创 2018-10-25 16:52:40 · 192 阅读 · 0 评论 -
【LeetCode 006】Zigzag Conversion.md
题目The 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 legibility)P A H NA P L S I ...原创 2018-10-08 21:06:19 · 260 阅读 · 0 评论 -
【004】Median of Two Sorted Arrays.md
【004】Median of Two Sorted Arrays题目There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log ...原创 2018-09-28 14:57:43 · 183 阅读 · 0 评论 -
【LeetCode题解-005】longest Palindrome Substring
题目Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Exam...原创 2018-10-13 11:23:16 · 500 阅读 · 0 评论 -
【LeetCode题解---003】Longest Substring Without Repeating Characters
题目Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:I...原创 2018-09-26 15:52:12 · 252 阅读 · 0 评论 -
【LeetCode题解---007】 Reverse Integer
今天的题目很简单,毕竟大过节的,也不能太放肆,太难为自己题目Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21N...原创 2018-10-02 19:27:25 · 229 阅读 · 0 评论 -
【LeetCode题解---2】Add Two Numbers.md
【LeetCode题解—2】Add Two Numbers题目You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single dig...原创 2018-09-25 18:37:38 · 258 阅读 · 0 评论 -
【LeetCode题解---771】Jewels and Stones.md
【LeetCode题解—771】Jewels and Stones题目You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have....原创 2018-09-25 18:24:25 · 256 阅读 · 0 评论 -
【LeetCode - 018】四数之和
四数之和题目Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements ...原创 2018-12-01 20:53:36 · 230 阅读 · 0 评论