1、最大连续子数组
    https://leetcode-cn.com/problems/lian-xu-zi-shu-zu-de-zui-da-he-lcof/solution/jian-dan-dp-by-1nxctrvewn-itv5/
    dp[i] 代表到i时的最大子序列的值,由dp[i-1] + 当前值 和当前值相比
    (如果当前值大于前子序列+当前值,那么当前值就是最大子序列)

    1. var maxSubArray = function(nums) {
    2. if (!nums.length) return
    3. let max_here = nums[0]
    4. let max_so_far = nums[0]
    5. for (let i = 1; i < nums.length; i++) {
    6. max_here = Math.max(nums[i], max_here + nums[i])
    7. max_so_far = Math.max(max_here, max_so_far)
    8. }
    9. return max_so_far
    10. };

    2、股票的最大利润
    https://leetcode-cn.com/problems/gu-piao-de-zui-da-li-run-lcof/solution/

    1. var maxProfit = function(prices) {
    2. let min = Number.MAX_VALUE
    3. let max = 0
    4. for (let p of prices) {
    5. max = Math.max(p - min, max)
    6. min = Math.min(min, p)
    7. }
    8. return max
    9. };