- 博客(36)
- 收藏
- 关注
原创 【LeetCode】50. Pow(x, n)
题目:Implementpow(x,n), which calculatesxraised to the powern(xn).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100Example 3:Input: 2.00...
2019-04-29 22:44:32 65
原创 【LeetCode】49. Group Anagrams
题目:Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat","tan"], ["bat"]]Note:All inputs...
2019-04-29 22:29:23 79
原创 【LeetCode】48. Rotate Image
题目:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the imagein-place, which means you have to modify the input 2D mat...
2019-04-28 23:15:54 67
原创 【LeetCode】47. Permutations II
题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ [1,1,2], [1,2,1], [2,1,1]]描述:给出一个有重复元素的数组,...
2019-04-28 21:09:34 73
原创 【LeetCode】46. Permutations
题目:Given a collection ofdistinctintegers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]描述:给出一个数组,...
2019-04-28 20:57:23 92
原创 【LeetCode】45. Jump Game II
题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal ...
2019-04-27 14:02:27 185
原创 【LeetCode】44. Wildcard Matching
题目:Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (includin...
2019-04-25 22:26:42 180
原创 【LeetCode】43. Multiply Strings
题目:Given two non-negative integersnum1andnum2represented as strings, return the product ofnum1andnum2, also represented as a string.Example 1:Input: num1 = "2", num2 = "3"Output: "6"E...
2019-04-23 22:06:43 79
原创 【LeetCode】42. Trapping Rain Water
题目:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented by ...
2019-04-23 08:49:52 66
原创 【LeetCode】41. First Missing Positive【未完待续】
题目:Given an unsorted integer array, find the smallest missingpositive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input: [7,8,9,11,12]...
2019-04-21 22:08:16 66
原创 【LeetCode】40. Combination Sum II
题目:Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Each number incandidate...
2019-04-20 21:17:07 83
原创 【LeetCode】39. Combination Sum
题目:Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Thesamer...
2019-04-20 18:46:36 96
原创 【LeetCode】38. Count and Say
题目:The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211is read off as"one 1"or11.11is read...
2019-04-18 08:27:05 67
原创 【LeetCode】37. Sudoku Solver
题目:Write a program to solve a Sudoku puzzle by filling the empty cells.Asudoku solution must satisfyall ofthe following rules:Each of the digits1-9must occur exactlyonce in each row. Each...
2019-04-17 22:56:32 69
原创 【LeetCode】36. Valid Sudoku
题目:Determine if a9x9 Sudoku boardis valid.Only the filled cells need to be validatedaccording to the following rules:Each rowmust contain thedigits1-9without repetition. Each column must ...
2019-04-17 22:45:24 66
原创 【LeetCode】35. Search Insert Position
题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the arr...
2019-04-15 22:27:16 78
原创 【LeetCode】34. Find First and Last Position of Element in Sorted Array
题目:Given an array of integersnumssorted in ascending order, find the starting and ending position of a giventargetvalue.Your algorithm's runtime complexity must be in the order ofO(logn).I...
2019-04-15 21:48:56 92
原创 【LeetCode】33. Search in Rotated Sorted Array
题目:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,[0,1,2,4,5,6,7]might become[4,5,6,7,0,1,2]).You are given a target value to search. If f...
2019-04-15 20:30:12 104
原创 【LeetCode】32. Longest Valid Parentheses
题目:Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Explanation: The longest ...
2019-04-13 21:37:59 83
原创 【LeetCode】31. Next Permutation
题目:Implementnext permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possi...
2019-04-12 00:02:21 83
原创 【LeetCode】30. Substring with Concatenation of All Words【未完待续】
题目:You are given a string,s, and a list of words,words, that are all of the same length. Find all starting indices of substring(s) insthat is a concatenation of each word inwordsexactly once a...
2019-04-10 23:57:13 70
原创 【LeetCode】29. Divide Two Integers
题目:Given two integersdividendanddivisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividingdividendbydivisor.The integer divisio...
2019-04-09 08:42:02 124
原创 【LeetCode】28. Implement strStr()
题目:ImplementstrStr().Return the index of the first occurrence of needle in haystack, or-1if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Ex...
2019-04-07 21:45:09 82
原创 【LeetCode】27. Remove Element
题目:Given an arraynumsand a valueval, remove all instances of that valuein-placeand return the new length.Do not allocate extra space for another array, you must do this bymodifying the input...
2019-04-07 16:18:16 65
原创 【LeetCode】26. Remove Duplicates from Sorted Array
题目:Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this bymo...
2019-04-07 12:43:21 92
原创 【LeetCode】25. Reverse Nodes in k-Group
题目:Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.kis a positive integer and is less than or equal to the length of the linked list. If the numbe...
2019-04-06 22:07:41 71
原创 【LeetCode】24. Swap Nodes in Pairs
题目:Given alinked list, swap every two adjacent nodes and return its head.You maynotmodify the values in the list's nodes, only nodes itself may be changed.Example:Given 1->2->3-&g...
2019-04-06 17:52:47 62
原创 【LeetCode】23. Merge k Sorted Lists
题目:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]Output: 1->1->2->3-&...
2019-04-06 16:30:56 74
原创 【LeetCode】22. Generate Parentheses
题目:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:[ "((()))", "(()())", "(())()", "()...
2019-04-06 15:15:41 99
原创 【LeetCode】21. Merge Two Sorted Lists
题目: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 two lists.Example:Input: 1->2->4, 1->3->4Outpu...
2019-04-05 23:13:19 74
原创 【LeetCode】20. Valid Parentheses
题目:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type...
2019-04-05 22:48:42 68
原创 【LeetCode】19. Remove Nth Node From End of List
题目:Given a linked list, remove then-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the e...
2019-04-04 20:15:46 70
原创 【LeetCode】18. 4Sum
题目:Given an arraynumsofnintegers and an integertarget, are there elementsa,b,c, anddinnumssuch thata+b+c+d=target? Find all unique quadruplets in the array which gives the su...
2019-04-04 08:48:30 79
原创 【LeetCode】17. Letter Combinations of a Phone Number
题目:Given a string containing digits from2-9inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) i...
2019-04-04 00:21:14 90
原创 【LeetCode】16. 3Sum Closest
题目:Given an arraynumsofnintegers and an integertarget, find three integers innumssuch that the sum is closest totarget. Return the sum of the three integers. You may assume that each input w...
2019-04-02 23:19:23 87
原创 【LeetCode】15. 3Sum
题目:Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not...
2019-04-02 00:50:13 118
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人