- 博客(7)
- 收藏
- 关注
原创 Leedcode 19 Remove Boxes
1、题目描述 Given several boxes with different colors represented by different positive numbers. You may experience several rounds to remove boxes until there is no box left. Each time you can choose so
2017-06-28 13:45:20 264
原创 Leetcode 18 Course Schedule
1、题目描述 There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as
2017-06-13 10:05:43 242
原创 排序算法之快速排序的理解与实现
快速排序复杂度等级为O(NlogN),采用分治的算法思想, 1、一个待排序数组nums,从中随机选择一个元素作为基准,这里笔者选择第一个元素为base, 2、这时nums[0]被挖了一个坑,然后从数组的末尾j=N-1开始遍历,直到j处的元素小于base,将该元素赋给nums[0], 3、然后i=1开始遍历直至i处得元素大于base值时,将其填到nums[j]的坑中, 4、这样循环往复2、3,
2017-06-08 23:47:35 236
原创 排序算法之归并排序的理解与实现
归并排序,是分治算法的一个经典应用, 归并排序,利用分治的思想,将一个数组先一半一半分解为规模更小的数组,直至规模为1,然后小数组进行排序,在将已经排序的小数组逐渐合并为大数组,直至最终合并为原数组大小的已排好序的新数组。 实现代码如下(c++)#include<iostream> #include<cmath> #include<vector> using namespace std;// s
2017-06-08 12:21:17 359
原创 LeetCode 17 Jump Game II
1、题目描述 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 goa
2017-06-05 21:12:03 196
原创 LeetCode 16 Jump Game
1、题目描述 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. Determin
2017-06-05 20:21:31 204
原创 LeetCode 15 Maximum Subarray
1、题目描述 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,
2017-06-03 23:21:54 235
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人