自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

AIpush的博客

船到桥头

  • 博客(201)
  • 收藏
  • 关注

原创 LeetCode43. Multiply Strings(思路及python解法)

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"Exampl...

2020-01-16 11:45:12 529

原创 LeetCode40. Combination Sum II(思路及python解法)

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Each number incandidatesmay...

2020-01-16 11:09:40 401

原创 LeetCode80. Remove Duplicates from Sorted Array II(思路及python解法)

Given a sorted arraynums, remove the duplicatesin-placesuch that duplicates appeared at mosttwiceand return the new length.Do not allocate extra space for another array, you must do this bymod...

2020-01-15 21:47:07 297

原创 LeetCode31. Next Permutation(思路及python解法)

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 possible o...

2020-01-15 20:46:28 298

原创 LeetCode16. 3Sum Closest(思路及python解法)

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 would ...

2020-01-15 11:52:22 259

原创 LeetCode18. 4Sum (思路及python解法)

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 sum oftar...

2020-01-14 21:54:53 210

原创 LeetCode1038. Binary Search Tree to Greater Sum Tree(思路及python解法)

Given the root of a binarysearchtree with distinct values, modify it so that everynodehas a new value equal to the sum of the values of the original tree that are greater than or equal tonode.val...

2020-01-14 17:53:53 233

原创 LeetCode29. Divide Two Integers(思路及python解法)

Given two integersdividendanddivisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividingdividendbydivisor.The integer division sho...

2020-01-12 21:52:09 384 1

原创 LeetCode146. LRU Cache(思路及python解法)

Design and implement a data structure forLeast Recently Used (LRU) cache. It should support the following operations:getandput.get(key)- Get the value (will always be positive) of the key if th...

2020-01-12 19:15:50 293

原创 LeetCode328. Odd Even Linked List(思路及python解法)

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in p...

2020-01-12 18:27:02 263

原创 LeetCode134. Gas Station(思路及python解法)

There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[i]of gas to travel from stationito its ...

2020-01-12 17:55:39 363

原创 LeetCode334. Increasing Triplet Subsequence(思路及python解法)

Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should:Return true if there existsi, j, ksuch thatarr[i]<arr[j...

2020-01-12 17:00:22 176

原创 LeetCode395. Longest Substring with At Least K Repeating Characters(思路及python解法)

Find the length of the longest substringTof a given string (consists of lowercase letters only) such that every character inTappears no less thanktimes.Example 1:Input:s = "aaabb", k = 3...

2020-01-11 22:29:35 228

原创 LeetCode454. 4Sum II(思路及python解法)

Given four lists A, B, C, D of integer values, compute how many tuples(i, j, k, l)there are such thatA[i] + B[j] + C[k] + D[l]is zero.To make problem a bit easier, all A, B, C, D have same lengt...

2020-01-11 21:43:44 214

原创 LeetCode166. Fraction to Recurring Decimal(思路及python解法)

Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.Exa...

2020-01-10 23:12:38 344

原创 LeetCode150. Evaluate Reverse Polish Notation(思路及python解法)

Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Note:Division between two integers ...

2020-01-10 22:29:07 239

原创 LeetCode322. Coin Change(思路及python解法)

You are given coins of different denominations and a total amount of moneyamount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money ...

2020-01-10 20:57:56 512

原创 LeetCode240. Search a 2D Matrix II(思路及python解法)

Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right. Integers in each...

2020-01-09 23:21:48 221

原创 LeetCode227. Basic Calculator II(思路及python解法)

Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators and empty spaces. The integer division should tru...

2020-01-08 22:20:18 263

原创 LeetCode222. Count Complete Tree Nodes (思路及python解法)

Given acompletebinary tree, count the number of nodes.Note:Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, except possibly the last, is completely fil...

2020-01-04 21:00:28 205

原创 LeetCode404. Sum of Left Leaves(思路及python解法)

Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24....

2020-01-03 17:36:16 198

原创 LeetCode236. Lowest Common Ancestor of a Binary Tree(思路及python解法)

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p...

2020-01-02 22:45:10 299

原创 LeetCode179. Largest Number(思路及python解法)

Given a list of non negative integers, arrange them such that they form the largest number.Example 1:Input: [10,2]Output: "210"Example 2:Input: [3,30,34,5,9]Output: "9534330"将数组中的数组合成一...

2020-01-02 18:47:46 400

原创 LeetCode131. Palindrome Partitioning(思路及python解法)

Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.Example:Input:"aab"Output:[ ["aa","b"], ["a","a"...

2019-12-30 15:57:17 200

原创 LeetCode79. Word Search(思路及python解法)

Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically n...

2019-12-29 21:54:46 253

原创 LeetCode39. Combination Sum(思路及python解法)

ShareGiven asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Thesame...

2019-12-29 01:09:12 261

原创 LeetCode54. Spiral Matrix(思路及python解法)

Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.Example 1:Input:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]Output: [1,2,3,6,9,8,7,4,5]...

2019-12-28 16:24:21 299 1

原创 LeetCode36. Valid Sudoku(思路及python解法)

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 conta...

2019-12-27 16:38:29 192

原创 LeetCode22. Generate Parentheses(思路及python解法)

Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())"...

2019-12-26 21:25:45 172

原创 LeetCode15. 3Sum(思路及python解法)

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 cont...

2019-12-26 20:59:11 256

原创 LeetCode73. Set Matrix Zeroes(思路及python解法)

Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do itin-place.Example 1:Input: [ [1,1,1], [1,0,1], [1,1,1]]Output: [ [1,0,1], [0,0,0], [1,0,1]]将...

2019-12-21 15:58:32 215

原创 LeetCode56. Merge Intervals(思路及python解法)

Given a collection of intervals, merge all overlapping intervals.Example 1:Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] overlaps...

2019-12-20 22:56:30 946

原创 LeetCode55. Jump Game(思路及python解法)

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.Determine if yo...

2019-12-20 21:20:12 194

原创 LeetCode50. Pow(x, n)(思路及python解法)

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.00000, ...

2019-12-20 19:19:08 197

原创 LeetCode41. First Missing Positive(思路及python解法)

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]Outpu...

2019-12-20 18:22:50 206

原创 LeetCode49. Group Anagrams (思路及python解法)

Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat","tan"], ["bat"]]把相同字母,不同顺序的单词放在一起。思路就...

2019-12-20 18:03:02 256

原创 LeetCode17. Letter Combinations of a Phone Number(思路及python解法)

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) is giv...

2019-12-19 23:27:49 104

原创 LeetCode34. Find First and Last Position of Element in Sorted Array (思路及python解法)

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).If the...

2019-12-19 23:27:25 179

原创 LeetCode11. Container With Most Water (思路及python解法)

Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis at (i,ai) and (i, 0). Find two...

2019-12-19 10:54:50 177

原创 LeetCode8. String to Integer (atoi)(思路及python解法)

Implementatoiwhichconverts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from thi...

2019-12-18 22:25:11 123

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除