leetcode
梦中的冰原
这个作者很懒,什么都没留下…
展开
-
[LeetCode]Two Sum
[LeetCode]Two SumDescrition: 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原创 2017-05-23 07:32:28 · 230 阅读 · 0 评论 -
[LeetCode]Implement strStr()
Description: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.解析: 这是算法中比较经典的问题,判断一个字符串是否是另一个字符串的子串。这个题目最经典的算法应该是KMP算法,不熟悉的朋友原创 2017-07-13 07:59:36 · 192 阅读 · 0 评论 -
[LeetCode]Search in Rotated Sorted Array
Description: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If f原创 2017-07-13 07:51:59 · 193 阅读 · 0 评论 -
[LeetCode]Search for a Range
Description: Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If原创 2017-07-13 07:20:03 · 257 阅读 · 0 评论 -
[LeetCode]3Sum Closest
Description: 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原创 2017-06-30 07:58:20 · 207 阅读 · 0 评论 -
[LeetCode]Container With Most Water
Description: 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)原创 2017-06-08 07:48:32 · 259 阅读 · 0 评论 -
[LeetCode]String to Integer (atoi)
Description: Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible原创 2017-06-05 07:34:38 · 230 阅读 · 0 评论 -
[LeetCode]Median of Two Sorted Arrays
Description: 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 (m+n)).Example 1: nums1原创 2017-06-05 07:21:16 · 178 阅读 · 0 评论 -
[LeetCode]ZigZag Conversion
Description: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 N A原创 2017-05-31 08:06:40 · 224 阅读 · 0 评论 -
[LeetCode]Longest Substring Without Repeating Characters
Description: Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b原创 2017-05-27 08:04:17 · 167 阅读 · 0 评论 -
[LeetCode]Reverse Integer
Description: Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Have you thought about this? Here are some good questions to ask before coding. Bonus points fo原创 2017-05-26 07:58:14 · 237 阅读 · 0 评论 -
[LeetCode]AddTwoNumbers
[LeetCode] Add Two Numbers Descrition: 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原创 2017-05-25 00:02:32 · 196 阅读 · 0 评论 -
[LeetCode] Longest Valid Parentheses
Description: Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “原创 2017-07-17 07:22:36 · 264 阅读 · 0 评论