- 博客(230)
- 收藏
- 关注
原创 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 259
原创 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 244
原创 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 251
原创 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 173
原创 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 128
原创 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 159
原创 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 244
原创 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 261
原创 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 113
原创 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 116
原创 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 189
原创 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 173
原创 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 127
原创 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 116
原创 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 108
原创 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 107
原创 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 153
原创 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 181
原创 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 200
原创 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 112
原创 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 128
原创 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 154
原创 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 91
原创 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 103
原创 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 147
原创 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 142
原创 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 199
原创 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 116
原创 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 259
原创 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 97
原创 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 134
原创 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 140
原创 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 159
原创 剑指offer之矩形覆盖
剑指offer之矩形覆盖题目描述解题思路Code总结题目描述我们可以用2*1的小矩形横着或者竖着去覆盖更大的矩形。请问用n个2*1的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?解题思路其实动手推一下就会发现是一个Fibonacci数列f(0) = 0;f(1) = 1;f(2) = 2;…f(n) = f(n-1)+f(n-2);Codecppclass S...
2019-03-09 16:55:04 77
原创 PAT Advanced 1032 Sharing (25 )
PAT Advanced 1032 Sharing (25 )题目描述Input Specification:Output Specification:Sample Input:Sample Output:解题思路Code题目描述Input Specification:Output Specification:Sample Input:11111 22222 967890 i 0...
2019-03-01 17:50:14 155
原创 PAT Advanced 1143 Lowest Common Ancestor (30 )
PAT Advanced 1143 Lowest Common Ancestor (30 )题目描述Input Specification:Output Specification:Sample Input:Sample Output:解题思路Code题目描述The lowest common ancestor (LCA) of two nodes U and V in a tree is t...
2019-03-01 17:39:12 96
原创 PAT Advanced 1155 Heap Paths (30 )
PAT Advanced 1155 Heap Paths (30 )题目描述Input Specification:Output Specification:Sample Input:Sample Output:解题思路Code题目描述In computer science, a heap is a specialized tree-based data structure that sati...
2019-03-01 17:17:32 113
原创 PAT Advanced 1154 Vertex Coloring (25 )
PAT Advanced 1154 Vertex Coloring (25 )题目描述Input Specification:Output Specification:Sample Input:Sample Output:解题思路Code题目描述A proper vertex coloring is a labeling of the graph’s vertices with colors ...
2019-03-01 17:07:25 135
原创 层序和中序重建二叉树
层序和中序重建二叉树题目描述Input Specification:Output Specification:Sample Input:Sample Output:解题思路Code题目描述输入一棵二叉树的层序和中序遍历,分别输出其前序和后序遍历Input Specification:第一行输入树的大小,接下来一行给出树的层序遍历,最后一行给出树的中序遍历。Output Specifica...
2019-03-01 12:19:49 1264
原创 PAT Advanced 1072 Gas Station (30 )
PAT Advanced 1072 Gas Station (30 )题目描述Input Specification:Output Specification:Sample Input:Sample Output:解题思路Code题目描述A gas station has to be built at such a location that the minimum distance betw...
2019-02-28 22:14:03 104
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人