
LeetCode
gq97
这个作者很懒,什么都没留下…
展开
-
LeetCode 2. Add Two Numbers
LeetCode 2. Add Two NumbersDescriptionExampleCodeConclusionDescriptionYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each...原创 2019-03-31 17:25:18 · 191 阅读 · 0 评论 -
LeetCode 24. Swap Nodes in Pairs
LeetCode 24. Swap Nodes in PairsDescriptionExampleCodeConclusionDescriptionGiven a linked list, swap every two adjacent nodes and return its head.You may not modify the values in the list’s nodes, ...原创 2019-05-26 22:09:36 · 336 阅读 · 0 评论 -
LeetCode 25. Reverse Nodes in k-Group
LeetCode 25. Reverse Nodes in k-GroupDescriptionExampleNoteCodeConclusionDescriptionGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive ...原创 2019-05-26 22:31:13 · 303 阅读 · 0 评论 -
LeetCode 26. Remove Duplicates from Sorted Array
LeetCode 26. Remove Duplicates from Sorted ArrayDescriptionExampleClarificationCodeConclusionDescriptionGiven a sorted array nums, remove the duplicates in-place such that each element appear only o...原创 2019-05-26 22:43:37 · 297 阅读 · 0 评论 -
LeetCode 17. Letter Combinations of a Phone Number
LeetCode 17. Letter Combinations of a Phone NumberDescriptionExampleNoteCodeConclusionDescriptionGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the...原创 2019-05-17 21:28:06 · 345 阅读 · 0 评论 -
LeetCode 27. Remove Element
LeetCode 27. Remove ElementDescriptionExampleClarificationCodeConclusionDescriptionGiven an array nums and a value val, remove all instances of that value in-place and return the new length.Do not ...原创 2019-05-27 21:37:11 · 341 阅读 · 0 评论 -
LeetCode 22. Generate Parentheses
LeetCode 22. Generate ParenthesesDescriptionExampleCodeConclusionDescriptionGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.ExampleFor exampl...原创 2019-05-23 22:03:05 · 158 阅读 · 0 评论 -
LeetCode 23. Merge k Sorted Lists
LeetCode 23. Merge k Sorted ListsDescriptionExampleCodeConclusionDescriptionMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.ExampleInput:[ 1-&g...原创 2019-05-23 22:12:49 · 258 阅读 · 0 评论 -
LeetCode 30. Substring with Concatenation of All Words
LeetCode 30. Substring with Concatenation of All WordsDescriptionExampleCodeConclusionDescriptionYou are given a string, s, and a list of words, words, that are all of the same length. Find all star...原创 2019-06-06 17:00:38 · 291 阅读 · 0 评论 -
LeetCode 28. Implement strStr
LeetCode 28. Implement strStrDescriptionExampleClarificationCodeConclusionDescriptionImplement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part o...原创 2019-05-29 21:43:17 · 383 阅读 · 0 评论 -
LeetCode 29. Divide Two Integers
LeetCode 29. Divide Two IntegersDescriptionExampleNoteCodeConclusionDescriptionGiven two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.R...原创 2019-05-29 21:52:59 · 330 阅读 · 0 评论 -
LeetCode 50. Pow(x, n)
LeetCode 50. Pow(x, nDescriptionExampleNoteCodeConclusionDescriptionImplement pow(x, n), which calculates x raised to the power n (xn).ExampleNote-100.0 < x < 100.0n is a 32-bit signed i...原创 2019-06-25 18:45:28 · 310 阅读 · 0 评论 -
LeetCode 39. Combination Sum
LeetCode 39. Combination SumDescriptionNoteExampleCodeConclusionDescriptionGiven a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinatio...原创 2019-06-18 10:46:09 · 292 阅读 · 0 评论 -
LeetCode 40. Combination Sum II
LeetCode 40. Combination Sum IIDescriptionNoteExampleCodeConclusionDescriptionGiven a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candi...原创 2019-06-18 11:06:57 · 263 阅读 · 0 评论 -
LeetCode 41. First Missing Positive
LeetCode 41. First Missing PositiveDescriptionNoteExampleCodeConclusionDescriptionGiven an unsorted integer array, find the smallest missing positive integer.NoteYour algorithm should run in O(n) ...原创 2019-06-18 11:27:30 · 392 阅读 · 0 评论 -
LeetCode 16. 3Sum Closest
LeetCode 16. 3Sum ClosestDescriptionExampleCodeConclusionDescriptionGiven an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Retur...原创 2019-05-17 09:56:05 · 235 阅读 · 0 评论 -
LeetCode 21. Merge Two Sorted Lists
LeetCode 21. Merge Two Sorted ListsDescriptionExampleCodeConclusionDescriptionMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of...原创 2019-05-21 21:54:45 · 221 阅读 · 0 评论 -
LeetCode 15. 3Sum
LeetCode 15. 3SumDescriptionExampleCodeConclusionDescriptionGiven an array numsof n integers, are there elements a, b, c in numssuch that a + b + c = 0? Find all unique triplets in the array which g...原创 2019-05-16 09:30:19 · 155 阅读 · 0 评论 -
LeetCode 3. Longest Substring Without Repeating Characters
LeetCode 3. Longest Substring Without Repeating CharactersDescriptionExampleCodeConclusionDescriptionGiven a string, find the length of the longest substring without repeating characters.ExampleC...原创 2019-04-02 11:39:23 · 173 阅读 · 0 评论 -
LeetCode 4. Median of Two Sorted Arrays
LeetCode 4. Median of Two Sorted ArraysDescriptionExampleCodeConclusionDescriptionThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. ...原创 2019-04-02 15:14:06 · 166 阅读 · 0 评论 -
LeetCode 7. Reverse Integer
LeetCode 7. Reverse IntegerDescriptionExampleCodeConclusionDescriptionGiven a 32-bit signed integer, reverse digits of an integer.ExampleCodejavaclass Solution { public int reverse(int x)...原创 2019-04-20 21:19:11 · 398 阅读 · 0 评论 -
LeetCode 11. Container With Most Water
LeetCode 11. Container With Most WaterDescriptionExampleCodeConclusionDescriptionGiven n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines a...原创 2019-04-25 22:13:05 · 222 阅读 · 0 评论 -
LeetCode 6. ZigZag Conversion
LeetCode 6. ZigZag ConversionDescriptionExampleCodeConclusionDescriptionExampleCodejavaclass Solution { public String convert(String s, int numRows) { if(numRows < 2 || s == nu...原创 2019-04-16 23:09:13 · 144 阅读 · 0 评论 -
LeetCode 8. String to Integer (atoi)
LeetCode 8. String to Integer (atoiDescriptionNoteExampleCodeConclusionDescriptionImplement atoi which converts a string to an integer.The function first discards as many whitespace characters as n...原创 2019-04-21 23:16:17 · 149 阅读 · 0 评论 -
LeetCode 12. Integer to Roman
LeetCode 12. Integer to RomanDescriptionExampleCodeConclusionDescriptionRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V ...原创 2019-04-26 22:48:36 · 144 阅读 · 0 评论 -
LeetCode 9. Palindrome Number
LeetCode 9. Palindrome NumberDescriptionExampleFollow upCodeConclusionDescriptionDetermine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward....原创 2019-04-22 21:58:44 · 237 阅读 · 0 评论 -
LeetCode 13. Roman to Integer
LeetCode 13. Roman to IntegerDescriptionExampleCodeConclusionDescriptionRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V ...原创 2019-04-28 00:03:48 · 120 阅读 · 0 评论 -
LeetCode 10. Regular Expression Matching
LeetCode 10. Regular Expression MatchingDescriptionNoteExampleCodeConclusionDescriptionGiven an input string (s) and a pattern (p), implement regular expression matching with support for'.'and'*'....原创 2019-04-23 22:32:11 · 186 阅读 · 0 评论 -
LeetCode 18. 4Sum
LeetCode 18. 4SumDescriptionExampleNoteCodeConclusionDescriptionGiven 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? F...原创 2019-05-19 23:57:00 · 351 阅读 · 0 评论 -
LeetCode 19. Remove Nth Node From End of List
LeetCode 19. Remove Nth Node From End of ListDescriptionExampleNoteCodeConclusionDescriptionGiven a linked list, remove the n-th node from the end of list and return its head.ExampleNoteGiven n ...原创 2019-05-20 00:01:59 · 265 阅读 · 0 评论 -
LeetCode 14. Longest Common Prefix
LeetCode 14. Longest Common PrefixDescriptionExampleNoteCodeConclusionDescriptionWrite a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, ...原创 2019-05-14 21:37:22 · 241 阅读 · 0 评论 -
LeetCode 20. Valid Parentheses
LeetCode 20. Valid ParenthesesDescriptionExampleCodeConclusionDescriptionGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An inp...原创 2019-05-21 11:18:39 · 223 阅读 · 0 评论 -
LeetCode 47. Permutations II
LeetCode 47. Permutations IIDescriptionExampleCodeConclusionDescriptionGiven a collection of numbers that might contain duplicates, return all possible unique permutations.ExampleCodejavaclas...原创 2019-06-24 22:39:04 · 351 阅读 · 0 评论