不为成仙,只为在这红尘中等你回来。

121. Best Time to Buy and Sell Stock [Easy] [Array]

    ### 题意 Say you have an array for which the `i**th` element is the price of a given stock on day i. 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stoc...

    阅读全文>>

2018年3月29日 22:14 作者:nancy 分类:[LeetCode] 511

53. Maximum Subarray [Easy] [Array | Dynamic Programming]

    ### 题意 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 Example: ```python Input: [-2,1,-3,4,-1,2,...

    阅读全文>>

2018年3月23日 20:49 作者:nancy 分类:[LeetCode] 439