- 博客(18)
- 收藏
- 关注
原创 LeetCode 55.Jump Game & 56.Merge Intervals
Problem 55 Jump GameGiven 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 tha
2017-06-26 11:04:52 344
原创 LeetCode 50.Pow(x, n) & 54.Spiral Matrix
Problem 50 Pow(x, n)Implement pow(x, n).解题思路:1. 题目要求实现 x 的 n 次幂,原理其实很简单,直接n个x连乘即可,但是肯定会超时,所以需要考虑效率更高的算法2. 所考虑用分治的思想来解决问题:pow(x,n) = pow(x,n/2) ^23. 需要考虑n为负数的情况,同时如果直接用pow(x,n/2) * pow(
2017-06-13 10:37:02 319
原创 LeetCode 48.Rotate Image & 49.Group Anagrams
Problem 48 Rotate ImageYou are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?解题思路:方法1:1. 如果不是直接
2017-06-06 18:19:11 292
原创 LeetCode 43.Multiply Strings & 46.Permutations & 47.Permutations II
Problem 43 Multiply StringsGiven two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.Note:The length of both num1 and num2 is Both num
2017-05-28 11:44:49 332
原创 LeetCode 39.Combination Sum & 40.Combination Sum II
Problem 39 Combination SumGiven a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The sam
2017-05-21 15:39:30 343
原创 LeetCode 34.Search for a Range & 36.Valid Sudoku
Problem 34 Search for a RangeGiven an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be i
2017-05-10 19:52:13 312
原创 LeetCode 31.Next Permutation & 33.Search in Rotated Sorted Array
Problem 31 Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must re
2017-05-06 15:45:44 328
原创 LeetCode 494.Target Sum & 516.Longest Palindromic Subsequence
494.Target SumYou are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new
2017-04-22 20:52:53 253
原创 LeetCode 22.Generate Parentheses & 24.Swap Nodes in Pairs
Problem 22. Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()
2017-04-15 14:54:38 282
原创 LeetCode 17.Letter Combinations of a Phone Number & 19.Remove Nth Node From End of List
Problem 17. Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the
2017-04-12 23:22:55 340
原创 LeetCode 12.Integer to Roman & 15.3Sum
Problem 12. Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.解题思路:1. 首先要搞清楚罗马数字的拼写原则:罗马数字是阿拉伯数字传入之前使用的一种数码。罗马
2017-04-05 16:09:43 445
原创 LeetCode 399.Evaluate Division & 332.Reconstruct Itinerary
LeetCode Problem332&399 图论 解题思路
2017-03-19 20:03:03 269
原创 LeetCode 529.Minesweeper & 515.Find Largest Value in Each Tree Row
LeetCode Problem 529&515 深度搜索 思路小结
2017-03-12 15:46:35 271
原创 LeetCode 5.Longest Palindromic Substring & 241.Different Ways to Add Parentheses
LeetCode 算法练习 Problem 5&241 思路小结
2017-03-05 18:18:41 232
原创 LeetCode 2.Add Two Numbers & 3.Longest Substring Without Repeating Characters
LeetCode 算法练习 Problem 2&3 思路小结
2017-02-26 19:03:41 292
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人