LeetCode
文章平均质量分 65
aiuou
这个作者很懒,什么都没留下…
展开
-
126 word Ladder
Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can be changed at a timeEach intermediate word must exi原创 2015-03-21 14:33:53 · 339 阅读 · 0 评论 -
1 Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2015-03-22 13:54:22 · 217 阅读 · 0 评论 -
4 Median of Two Sorted Arrays
There are two sorted arrays A and B 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)).public class Solution { p原创 2015-03-22 14:08:54 · 244 阅读 · 0 评论 -
57 Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Examp原创 2015-03-22 13:48:38 · 389 阅读 · 0 评论 -
5 longest palindromic substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.public class Solut原创 2015-03-22 14:21:05 · 287 阅读 · 0 评论 -
30 Substring with Concatenation of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without原创 2015-03-22 13:55:28 · 209 阅读 · 0 评论 -
3 Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo原创 2015-03-22 14:06:44 · 176 阅读 · 0 评论 -
56 Merge Intervals
Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]./** * Definition for an interval. * public class原创 2015-03-22 13:45:56 · 228 阅读 · 0 评论 -
35 Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.原创 2015-03-22 14:00:07 · 310 阅读 · 0 评论 -
6 ZigZag Conversion
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原创 2015-03-22 14:23:45 · 275 阅读 · 0 评论