
LeetCode
文章平均质量分 53
niunc
这个作者很懒,什么都没留下…
展开
-
4. Median of Two Sorted Arrays
https://leetcode.com/problems/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...转载 2018-05-18 01:26:33 · 80 阅读 · 0 评论 -
5. Longest Palindromic Substring
https://leetcode.com/problems/longest-palindromic-substring/description/Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Input: "babad...原创 2018-05-19 00:43:26 · 83 阅读 · 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 I G...原创 2018-05-21 17:45:10 · 85 阅读 · 0 评论 -
7. Reverse Integer
https://leetcode.com/problems/reverse-integer/description/Given a 32-bit signed integer, reverse digits of an integer.Input: 123Output: 321Input: -123Output: -321Input: 120Output: 21Note:Assume we ...原创 2018-05-21 17:56:33 · 80 阅读 · 0 评论 -
8. String to Integer (atoi)
https://leetcode.com/problems/string-to-integer-atoi/description/Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the f...原创 2018-05-21 23:13:46 · 107 阅读 · 0 评论 -
9. Palindrome Number
https://leetcode.com/problems/palindrome-number/description/Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Input: 121Output: trueI...原创 2018-05-21 23:29:51 · 87 阅读 · 0 评论 -
1. Two Sum
https://leetcode.com/problems/two-sum/description/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 exa...原创 2018-05-16 16:24:07 · 73 阅读 · 0 评论 -
2. Add Two Numbers
https://leetcode.com/problems/add-two-numbers/description/You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their node...原创 2018-05-16 17:08:53 · 105 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters
https://leetcode.com/problems/longest-substring-without-repeating-characters/description/Given a string, find the length of the longest substring without repeating characters.Given "abcabcbb", the an...原创 2018-05-16 17:38:32 · 89 阅读 · 0 评论 -
10. Regular Expression Matching
https://leetcode.com/problems/regular-expression-matching/description/Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.'.' Matches any si...转载 2018-05-22 21:42:57 · 95 阅读 · 0 评论 -
11. Container With Most Water
https://leetcode.com/problems/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 ...转载 2018-05-22 22:07:00 · 93 阅读 · 0 评论 -
12. Integer to Roman
https://leetcode.com/problems/integer-to-roman/description/Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X ...原创 2018-05-22 22:31:54 · 253 阅读 · 0 评论 -
13. Roman to Integer
https://leetcode.com/problems/roman-to-integer/description/Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X ...原创 2018-05-22 22:39:31 · 62 阅读 · 0 评论 -
14. Longest Common Prefix
https://leetcode.com/problems/longest-common-prefix/description/Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty stri...原创 2018-05-22 22:49:15 · 88 阅读 · 0 评论 -
15. 3Sum
https://leetcode.com/problems/3sum/description/Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum ...原创 2018-05-22 23:22:37 · 75 阅读 · 0 评论 -
16. 3Sum Closest
https://leetcode.com/problems/3sum-closest/description/Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of th...原创 2018-05-28 21:26:27 · 70 阅读 · 0 评论 -
17. Letter Combinations of a Phone Number
https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could repre...原创 2018-05-28 22:07:47 · 77 阅读 · 0 评论 -
26. Remove Duplicates from Sorted Array
https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new len...原创 2018-07-29 09:23:01 · 80 阅读 · 0 评论 -
27. Remove Element
https://leetcode.com/problems/remove-element/description/Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for ...转载 2018-07-29 11:34:52 · 131 阅读 · 0 评论 -
28. Implement strStr()
https://leetcode.com/problems/implement-strstr/description/Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:...原创 2018-07-29 22:08:17 · 91 阅读 · 0 评论 -
29. Divide Two Integers
https://leetcode.com/problems/divide-two-integers/description/Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.Return the quotie...转载 2018-07-29 22:21:54 · 89 阅读 · 0 评论 -
18. 4Sum
https://leetcode.com/problems/4sum/description/Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique qu...原创 2018-07-26 21:11:39 · 85 阅读 · 0 评论 -
19. Remove Nth Node From End of List
https://leetcode.com/problems/remove-nth-node-from-end-of-list/description/Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2-...原创 2018-07-26 21:24:45 · 89 阅读 · 0 评论 -
20. Valid Parentheses
https://leetcode.com/problems/valid-parentheses/description/Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is...原创 2018-07-26 21:33:39 · 77 阅读 · 0 评论 -
21. Merge Two Sorted Lists
https://leetcode.com/problems/merge-two-sorted-lists/description/Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first tw...转载 2018-07-26 21:52:34 · 84 阅读 · 0 评论 -
22. Generate Parentheses
https://leetcode.com/problems/generate-parentheses/description/Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a so...原创 2018-07-26 22:10:34 · 86 阅读 · 0 评论 -
43. Multiply Strings
https://leetcode.com/problems/multiply-strings/description/Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.E...原创 2018-08-03 16:35:07 · 90 阅读 · 0 评论 -
30. Substring with Concatenation of All Words
https://leetcode.com/problems/substring-with-concatenation-of-all-words/description/You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices ...转载 2018-07-30 14:28:20 · 126 阅读 · 0 评论 -
44. Wildcard Matching
https://leetcode.com/problems/wildcard-matching/description/Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single ch...转载 2018-08-03 18:11:43 · 119 阅读 · 0 评论 -
45. Jump Game II
https://leetcode.com/problems/jump-game-ii/description/Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents yo...原创 2018-08-03 18:51:31 · 92 阅读 · 0 评论 -
46. Permutations
https://leetcode.com/problems/permutations/description/Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]import copyclass Solution(object): def perm...原创 2018-08-03 20:54:01 · 78 阅读 · 0 评论 -
47. Permutations II
https://leetcode.com/problems/permutations-ii/description/Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ ...原创 2018-08-03 20:58:51 · 90 阅读 · 0 评论 -
48. Rotate Image
https://leetcode.com/problems/rotate-image/description/You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-pl...原创 2018-08-04 09:31:30 · 81 阅读 · 0 评论 -
49. Group Anagrams
https://leetcode.com/problems/group-anagrams/description/Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate原创 2018-08-04 11:54:57 · 73 阅读 · 0 评论 -
50. Pow(x, n)
https://leetcode.com/problems/powx-n/description/Implement pow(x, n), which calculates x raised to the power n (xn).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000...原创 2018-08-04 12:04:50 · 98 阅读 · 0 评论 -
31. Next Permutation
https://leetcode.com/problems/next-permutation/description/Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement i...转载 2018-07-30 22:12:18 · 84 阅读 · 0 评论 -
51. N-Queens
https://leetcode.com/problems/n-queens/description/The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, retur...原创 2018-08-04 18:54:58 · 134 阅读 · 0 评论 -
52. N-Queens II
https://leetcode.com/problems/n-queens-ii/description/The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, re...原创 2018-08-04 19:30:41 · 105 阅读 · 0 评论 -
53. Maximum Subarray
https://leetcode.com/problems/maximum-subarray/description/Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.E...原创 2018-08-05 09:14:08 · 83 阅读 · 0 评论 -
54. Spiral Matrix
https://leetcode.com/problems/spiral-matrix/description/Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.Example 1:Input:[ [ 1, 2, 3 ],...原创 2018-08-05 10:07:05 · 105 阅读 · 0 评论