/images/avatar.png

LeetCode-56and57-Merge-Intervals

LeetCode-56-Merge-Intervals Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18]. 如例子中所示,每个数组的前后分别表示开始和结束,工作是合并有重叠的数组。例如,由于[1,3]和[2,6]有重

LeetCode-55-Jump-Game

LeetCode-55-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 if you are able to reach the last index. For example: A = [2,3,1,1,4], return true. A = [3,2,1,0,4], return false. 由题可知,数组的位置表示从该位置可

LeetCode-53-Maximum-Subarray

LeetCode-53-Maximum-Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. 最长子序列,又是一个动态规划的问题,关于动态规划,我们最主要的是要维护D

LeetCode-52-N-Queens-II

LeetCode-52-N-Queens-II Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 只返回N皇后问题结果的种数。 因此不需要每一个字符串置位了,只需要判断一个位置的横竖,斜45度和斜135度

LeetCode-51-N-Queens

LeetCode-51-N-Queens 经典的N皇后问题,重点是全排列的问题,但是这里由于N皇后的不重复行、列、斜的要求,在排列的过程中,比如从行开始排列,只能保证同行不重复,所