- 博客(230)
- 收藏
- 关注
原创 LeetCode 50. Pow(x, n)
LeetCode 50. Pow(x, nDescriptionExampleNoteCodeConclusion Description Implement pow(x, n), which calculates x raised to the power n (xn). Example Note -100.0 < x < 100.0 n is a 32-bit signed i...
2019-06-25 18:45:28
323
原创 LeetCode 47. Permutations II
LeetCode 47. Permutations IIDescriptionExampleCodeConclusion Description Given a collection of numbers that might contain duplicates, return all possible unique permutations. Example Code java clas...
2019-06-24 22:39:04
370
原创 LeetCode 41. First Missing Positive
LeetCode 41. First Missing PositiveDescriptionNoteExampleCodeConclusion Description Given an unsorted integer array, find the smallest missing positive integer. Note Your algorithm should run in O(n) ...
2019-06-18 11:27:30
406
原创 LeetCode 40. Combination Sum II
LeetCode 40. Combination Sum IIDescriptionNoteExampleCodeConclusion Description Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candi...
2019-06-18 11:06:57
270
原创 LeetCode 39. Combination Sum
LeetCode 39. Combination SumDescriptionNoteExampleCodeConclusion Description Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinatio...
2019-06-18 10:46:09
307
原创 LeetCode 30. Substring with Concatenation of All Words
LeetCode 30. Substring with Concatenation of All WordsDescriptionExampleCodeConclusion Description You 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
303
原创 LeetCode 29. Divide Two Integers
LeetCode 29. Divide Two IntegersDescriptionExampleNoteCodeConclusion Description Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. R...
2019-05-29 21:52:59
344
原创 LeetCode 28. Implement strStr
LeetCode 28. Implement strStrDescriptionExampleClarificationCodeConclusion Description Implement 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
402
原创 LeetCode 27. Remove Element
LeetCode 27. Remove ElementDescriptionExampleClarificationCodeConclusion Description Given 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
352
原创 LeetCode 26. Remove Duplicates from Sorted Array
LeetCode 26. Remove Duplicates from Sorted ArrayDescriptionExampleClarificationCodeConclusion Description Given a sorted array nums, remove the duplicates in-place such that each element appear only o...
2019-05-26 22:43:37
309
原创 LeetCode 25. Reverse Nodes in k-Group
LeetCode 25. Reverse Nodes in k-GroupDescriptionExampleNoteCodeConclusion Description Given 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
322
原创 LeetCode 24. Swap Nodes in Pairs
LeetCode 24. Swap Nodes in PairsDescriptionExampleCodeConclusion Description Given 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
345
原创 LeetCode 23. Merge k Sorted Lists
LeetCode 23. Merge k Sorted ListsDescriptionExampleCodeConclusion Description Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example Input: [ 1-&g...
2019-05-23 22:12:49
276
原创 LeetCode 22. Generate Parentheses
LeetCode 22. Generate ParenthesesDescriptionExampleCodeConclusion Description Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example For exampl...
2019-05-23 22:03:05
169
原创 LeetCode 21. Merge Two Sorted Lists
LeetCode 21. Merge Two Sorted ListsDescriptionExampleCodeConclusion 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...
2019-05-21 21:54:45
237
原创 LeetCode 20. Valid Parentheses
LeetCode 20. Valid ParenthesesDescriptionExampleCodeConclusion Description Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An inp...
2019-05-21 11:18:39
233
原创 LeetCode 19. Remove Nth Node From End of List
LeetCode 19. Remove Nth Node From End of ListDescriptionExampleNoteCodeConclusion Description Given a linked list, remove the n-th node from the end of list and return its head. Example Note Given n ...
2019-05-20 00:01:59
276
原创 LeetCode 18. 4Sum
LeetCode 18. 4SumDescriptionExampleNoteCodeConclusion 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? F...
2019-05-19 23:57:00
360
原创 LeetCode 17. Letter Combinations of a Phone Number
LeetCode 17. Letter Combinations of a Phone NumberDescriptionExampleNoteCodeConclusion Description Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the...
2019-05-17 21:28:06
363
原创 LeetCode 16. 3Sum Closest
LeetCode 16. 3Sum ClosestDescriptionExampleCodeConclusion 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. Retur...
2019-05-17 09:56:05
248
原创 LeetCode 15. 3Sum
LeetCode 15. 3SumDescriptionExampleCodeConclusion Description Given 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
163
原创 LeetCode 14. Longest Common Prefix
LeetCode 14. Longest Common PrefixDescriptionExampleNoteCodeConclusion Description Write 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
257
原创 LeetCode 13. Roman to Integer
LeetCode 13. Roman to IntegerDescriptionExampleCodeConclusion Description Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V ...
2019-04-28 00:03:48
133
原创 LeetCode 12. Integer to Roman
LeetCode 12. Integer to RomanDescriptionExampleCodeConclusion Description Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V ...
2019-04-26 22:48:36
150
原创 LeetCode 11. Container With Most Water
LeetCode 11. Container With Most WaterDescriptionExampleCodeConclusion Description Given 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
235
原创 LeetCode 10. Regular Expression Matching
LeetCode 10. Regular Expression MatchingDescriptionNoteExampleCodeConclusion Description Given an input string (s) and a pattern (p), implement regular expression matching with support for'.'and'*'. ...
2019-04-23 22:32:11
193
原创 LeetCode 9. Palindrome Number
LeetCode 9. Palindrome NumberDescriptionExampleFollow upCodeConclusion Description Determine 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
251
原创 LeetCode 8. String to Integer (atoi)
LeetCode 8. String to Integer (atoiDescriptionNoteExampleCodeConclusion Description Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as n...
2019-04-21 23:16:17
160
原创 LeetCode 7. Reverse Integer
LeetCode 7. Reverse IntegerDescriptionExampleCodeConclusion Description Given a 32-bit signed integer, reverse digits of an integer. Example Code java class Solution { public int reverse(int x)...
2019-04-20 21:19:11
404
原创 LeetCode 6. ZigZag Conversion
LeetCode 6. ZigZag ConversionDescriptionExampleCodeConclusion Description Example Code java class Solution { public String convert(String s, int numRows) { if(numRows < 2 || s == nu...
2019-04-16 23:09:13
155
原创 LeetCode 4. Median of Two Sorted Arrays
LeetCode 4. Median of Two Sorted ArraysDescriptionExampleCodeConclusion Description There 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
170
原创 LeetCode 3. Longest Substring Without Repeating Characters
LeetCode 3. Longest Substring Without Repeating CharactersDescriptionExampleCodeConclusion Description Given a string, find the length of the longest substring without repeating characters. Example C...
2019-04-02 11:39:23
189
原创 LeetCode 2. Add Two Numbers
LeetCode 2. Add Two NumbersDescriptionExampleCodeConclusion Description You 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
202
原创 剑指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); Code cpp class S...
2019-03-09 16:55:04
116
原创 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 9 67890 i 0...
2019-03-01 17:50:14
216
原创 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
225
原创 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
292
原创 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
202
原创 层序和中序重建二叉树
层序和中序重建二叉树题目描述Input Specification:Output Specification:Sample Input:Sample Output:解题思路Code 题目描述 输入一棵二叉树的层序和中序遍历,分别输出其前序和后序遍历 Input Specification: 第一行输入树的大小,接下来一行给出树的层序遍历,最后一行给出树的中序遍历。 Output Specifica...
2019-03-01 12:19:49
1420
原创 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
205
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人