- 博客(13)
- 收藏
- 关注
原创 Leetcode之Minimum Path Sum
题目:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:You can only move either down or right...
2019-03-31 14:22:51 72
原创 Leetcode之Unique paths II
题目:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach t...
2019-03-31 14:14:09 141
原创 Leetcode之Unique Paths
题目:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach t...
2019-03-21 15:45:21 92
原创 Leetcode之Rotate List
题目:Given a linkedlist, rotate the list to the right bykplaces, wherekis non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1->2->3->NULLE...
2019-03-20 11:32:26 78
原创 Leetcode之Permutation Sequence
题目:The set[1,2,3,...,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order, we get the following sequence forn= 3:"123" "132" "213" "231" ...
2019-03-20 10:01:16 105
原创 Leetcode之Spiral MatrixII
题目:Given a positive integern, generate a square matrix filled with elements from 1 ton2in spiral order.Example:Input: 3Output:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]]代码:方法一(使用bool数...
2019-03-14 11:08:09 89
原创 Leetcode之Length of Last Word
题目:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note:A word is ...
2019-03-13 11:22:10 95
原创 Leetcode之Insert Interval
题目:Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times....
2019-03-12 11:03:36 89
原创 leetcode之Merge Intervals
题目: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] ove...
2019-03-11 12:27:02 153
原创 Leetcode之Jump Game
题目: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 ...
2019-03-10 13:55:18 135
原创 Leetcode之 Spiral Matrix
题目: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...
2019-03-09 14:32:19 146
原创 leetcode之Maximum Subarray
题目:Given an integer arraynums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Expl...
2019-03-08 15:43:24 109
原创 leetcode之N-Queens II
题目:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return the number ofdistinct solutions to then-quee...
2019-03-07 21:19:22 152
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人