leetcode
Taswy
Fighting!!
展开
-
3. Longest Substring Without Repeating Characters
描述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", ...原创 2018-04-10 09:24:52 · 183 阅读 · 0 评论 -
1.Two Sum
Two Sum原创 2018-04-04 17:11:49 · 128 阅读 · 0 评论 -
18. 4Sum
问题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: The solution...原创 2018-04-10 09:36:07 · 219 阅读 · 0 评论 -
17. Letter Combinations of a Phone Number
问题Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit ...原创 2018-04-10 09:35:54 · 175 阅读 · 0 评论 -
16. 3Sum Closest
问题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 have exa...原创 2018-04-10 09:35:23 · 125 阅读 · 0 评论 -
15. 3Sum
问题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: The solution set must not contain...原创 2018-04-10 09:34:46 · 175 阅读 · 0 评论 -
14. Longest Common Prefix
问题Write a function to find the longest common prefix string amongst an array of strings.分析:最长前缀Pythonclass Solution: def longestCommonPrefix(self, strs): """ :type st...原创 2018-04-10 09:34:00 · 117 阅读 · 0 评论 -
11. 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-04-10 09:33:35 · 97 阅读 · 0 评论 -
7. 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: 21Note: Assume w...原创 2018-04-10 09:32:32 · 120 阅读 · 0 评论 -
4. 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 (m+n)).Example 1:nums1 = ...原创 2018-04-10 09:28:39 · 107 阅读 · 0 评论 -
804. Unique Morse Code Words
问题International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a"maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on.原创 2018-08-03 15:23:56 · 148 阅读 · 0 评论