Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/algorithm006-class02/algorithm006-class02
/ functions
Functions
5,772 in github.com/algorithm006-class02/algorithm006-class02
⨍
Functions
5,772
◇
Types & classes
2,815
Function
maxProduct
(nums)
Week_05/G20200447010070/LeetCode_152_070.js:12
Function
maxProduct
(nums)
Week_05/G20200343030430/LeetCode_152_430.js:5
Function
maxProduct
* 思路 标签:动态规划 1. 遍历数组时计算当前最大值,不断更新 2. 令imax为当前最大值,则当前最大值为 imax = max(imax * nums[i], nums[i]) 3. 由于存在负数,那么会导致最大的变最小的,最小的变最大的。因此还需要维护当前最小值imin,imin =
Week_05/G20200343030498/LeetCode_152_498.go:16
Function
maxProduct
(nums)
Week_05/G20200343030380/Leetcode-152-380.js:7
Method
maxProduct
(self, nums: List[int])
Week_05/G20200343030640/lesson12/152_maximum_product_subarray.py:10
Method
maxProduct
(int[] nums)
Week_05/G20200343030022/LeetCode_152_022.java:7
Method
maxProduct
(self, nums: List[int])
Week_05/G20200343030632/Leetcode_152_632.py:2
Method
maxProduct
Week_05/G20200343030462/leetcode-152-462.cpp:3
Method
maxProduct
(self, nums: List[int])
Week_05/G20200343030638/LeetCode-152-638.py:2
Function
maxProfit
leetcode submit region begin(Prohibit modification and deletion)
Week_03/G20200343030008/LeetCode_122_008.go:38
Function
maxProfit
(prices)
Week_03/G20200447010070/LeetCode_122_070.js:12
Function
maxProfit
(prices)
Week_03/G20200343030430/LeetCode_122_430.js:5
Function
maxProfit
(prices = [])
Week_03/G20200447010018/122.买卖股票的最佳时机-ii.js:65
Function
maxProfit
(prices []int)
Week_03/G20200343030026/LeetCode_122_026.go:1
Function
maxProfit
(prices)
Week_03/G20200447010024/LeetCode_122_024.js:64
Function
maxProfit
:type prices: List[int] :rtype: int
Week_03/G20200343030550/LeetCode_122_550.py:1
Function
maxProfit
(prices)
Week_03/G20200343030380/Leetcode-122-380.js:9
Function
maxProfit
(prices []int)
Week_03/G20200343030396/LeetCode_122_396.go:3
Function
maxProfit
(prices)
Week_03/G20200343030030/LeetCode_122_030.js:12
Function
maxProfit
(prices)
Week_05/G20200343030380/Leetcode-122-380.js:8
Function
maxProfit
(prices)
Week_05/G20200343030380/Leetcode-121-380.js:28
Method
maxProfit
(int[] prices)
Week_02/G20200343030460/LeetCode_122_460.java:34
Method
maxProfit
(int[] prices)
Week_03/G20200343030448/LeetCode_122_448.java:4
Method
maxProfit
(self, prices: List[int])
Week_03/G20200343030528/LeetCode_122_528.py:2
Method
maxProfit
Week_03/G20200343030400/LeetCode_122_400.cpp:6
Method
maxProfit
(int[] prices)
Week_03/G20200343030440/Leetcode_122_440.java:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030450/Leetcode_122_450.java:2
Method
maxProfit
Week_03/G20200343030428/LeetCode_122_428.cpp:10
Method
maxProfit
:type prices: List[int] :rtype: int
Week_03/G20200343030488/122.买卖股票的最佳时机-ii.py:9
Method
maxProfit
(self, prices: List[int])
Week_03/G20200389010036/LeetCode_122_036.py:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030518/leetcode_122_518.java:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030022/LeetCode_122_022.java:18
Method
maxProfit
(self, prices)
Week_03/G20190343020006/LeetCode_122_006.py:2
Method
maxProfit
(self, prices)
Week_03/G20200343030496/LeetCode_122_496.py:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030540/LeetCode_122_540.java:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030012/LeetCode_122_012.java:7
Method
maxProfit
(int[] prices)
Week_03/G20200343030584/LeetCode_122_584.java:23
Method
maxProfit
(int[] prices)
Week_03/G20200343030578/LeetCode_122_578.java:33
Method
maxProfit
(int[] prices)
Week_03/G20200343030580/LeetCode_122_580.java:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030404/LeetCode_122_404.java:2
Method
maxProfit
Week_03/G20200343030454/Leetcode_122_454.cpp:3
Method
maxProfit
(int[] prices)
Week_03/G20200343030376/LeedCode_122_376.java:13
Method
maxProfit
(int[] prices)
Week_03/G20200343030592/LeetCode_122_592.java:7
Method
maxProfit
(self, prices: List[int])
Week_03/G20200343030438/LeetCode_122_438.py:2
Method
maxProfit
Week_03/G20200343030636/LeetCode_122_636.cpp:51
Method
maxProfit
贪心算法计算最佳时机 只要当前位置的下一个位置比当前位置大,则当前位置买进,下一个位置卖出 @param prices @return
Week_03/G20200343030566/Leetcode_122_566.java:15
Method
maxProfit
Week_03/G20200343030614/LeetCode_122_614.cpp:4
Method
maxProfit
(int[] prices)
Week_03/G20200343030512/LeeCode_122_512.java:4
Method
maxProfit
Week_03/G20200343030544/LeetCode_122_544.cpp:3
Method
maxProfit
Week_03/G20200343030508/LeetCode_122_508.cpp:51
Method
maxProfit
(int[] prices)
Week_03/G20200343030572/LeetCode_122_572.java:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030364/LeetCode_122_364.java:8
Method
maxProfit
(int[] prices)
Week_03/G20200343030600/LeetCode_122_600.java:5
Method
maxProfit
(self, prices)
Week_03/G20200343030556/Leetcode_122_556.py:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030402/[122]买卖股票的最佳时机 II.java:34
Method
maxProfit
(int[] prices)
Week_03/G20200343030372/Best_time_to_buy_and_sell_stock_ii_122.java:9
Method
maxProfit
(int[] prices)
Week_03/G20200343030534/LeetCode_534_122.java:10
Method
maxProfit
使用贪心算法求解
Week_03/G20200343030462/leetcode-122-462.cpp:4
Method
maxProfit
(int[] prices)
Week_03/G20200343030422/LeetCode_122_422.java:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030386/LeetCode_122_386.java:35
Method
maxProfit
(int[] prices)
Week_03/G20200343030378/LeetCode_122_378.java:3
Method
maxProfit
(int[] prices)
Week_03/G20200343030494/LeetCode_122_494.java:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030020/best-time-to-buy-and-sell-stock-ii.java:2
Method
maxProfit
(int[] prices)
Week_03/G20200343030006/MaxProfit.java:4
Method
maxProfit
:type prices: List[int] :rtype: int
Week_03/G20200343030610/LeetCode_122_610.py:2
Method
maxProfit
Week_03/G20200343030506/LeetCode_122_506.cpp:10
Method
maxProfit
(self, prices: List[int])
Week_05/G20200343030638/LeetCode-121-638.py:2
Method
maxProfit
(self, prices: List[int])
Week_05/G20200343030638/LeetCode-122-638.py:2
Method
maxProfit1
(int[] prices)
Week_03/G20200343030436/122.买卖股票的最佳时机-ii.java:12
Method
maxProfit1
一次循环 时间复杂度:O(n) 空间复杂度:O(1) @param prices @return
Week_03/G20200343030564/LeetCode_121_564.java:62
Method
maxProfit1
贪心算法 当第i项小于i+1项时,在i时买入,在i+1时卖出 @param prices @return
Week_03/G20200343030426/MaxProfit122.java:35
Method
maxProfit2
(int[] prices)
Week_03/G20200343030436/122.买卖股票的最佳时机-ii.java:41
Method
maxProfit3
(int[] prices)
Week_03/G20200343030436/122.买卖股票的最佳时机-ii.java:55
Function
maxSlidingWindow
Week_01/G20200343030400/LeetCode_239-sec_400.c:4
Function
maxSlidingWindow
Week_01/G20200343030400/LeetCode_239_400.c:107
Function
maxSlidingWindow
(nums, k)
Week_01/G20200343030430/LeetCode_239_430.js:6
Method
maxSlidingWindow
(self, nums: List[int], k: int)
Week_01/G20200343030400/LeetCode_239_400.py:2
Method
maxSlidingWindow
Week_01/G20200343030400/LeetCode_239_400.cpp:6
Method
maxSlidingWindow
(int[] nums, int k)
Week_01/G20200343030518/InClass/LeetCode_239_518.java:15
Method
maxSlidingWindow
(int[] nums, int k)
Week_01/G20200343030020/sliding-window-maximum.java:11
Method
maxSlidingWindow
(int[] nums, int k)
Week_01/G20200343030542/LeetCode_239_542.java:5
Method
maxSlidingWindowBruteForce
(int[] nums, int k)
Week_01/G20200343030542/LeetCode_239_542.java:28
Method
maxSlidingWindowSimple
(int[] nums, int k)
Week_01/G20200343030542/LeetCode_239_542.java:44
Method
maxSlidingWindowWithDeque
(int[] nums, int k)
Week_01/G20200343030542/LeetCode_239_542.java:69
Function
maxSubArray
(nums)
Week_05/G20200447010070/LeetCode_53_070.js:12
Function
maxSubArray
(nums)
Week_05/G20200343030430/LeetCode_53_430.js:5
Function
maxSubArray
(nums)
Week_05/G20200343030380/Leetcode-53-380.js:7
Function
maxSubArray
Week_05/G20200343030634/leetcode_53_634.c:4
Method
maxSubArray
初始化最大和:maxSum = nums[0] dp[i-1]: nums[i]之前的元素和, 若dp[i-1] > 0, dp[i]=dp[i-1]+nums[i] 可能为正增益 若dp[i-1] <= 0, dp[
Week_05/G20200343030640/lesson12/53_maximum_subarray.py:10
Method
maxSubArray
(self, nums: List[int])
Week_05/G20200343030640/lesson12/53_maximum_subarray.py:29
Method
maxSubArray
(int[] nums)
Week_05/G20200343030022/LeetCode_53_022.java:19
Method
maxSubArray
(self, nums: List[int])
Week_05/G20200343030632/Leetcode_53_632.py:2
Method
maxSubArray
(int[] nums)
Week_05/G20200343030536/LeetCode_53_536.java:8
Method
maxSubArray
(int[] nums)
Week_05/G20200343030600/LeetCode_53_600.java:6
Method
maxSubArray
Week_05/G20200343030462/leetcode-53-462.cpp:3
Method
maxSubArray
(self, nums: List[int])
Week_05/G20200343030638/LeetCode-53-638.py:2
Function
maxSumSubmatrix
Week_05/G20200343030420/LeetCode_363_420.c:21
Method
maxSumSubmatrix
(int[][] matrix, int k)
Week_05/G20200343030436/363.矩形区域不超过-k-的最大数值和.java:9
Method
maxSumSubmatrix
(int[][] matrix, int k)
Week_05/G20200343030372/Max_sum_of_rectangle_no_larger_than_k_363.java:9
Function
max_profit
解法一、使用贪心算法 将问题转化成看是否每天都买卖。如果后一天卖出前一天的股票的利润为正,则计入总利润,如果收益是亏损或零的则不计入总利润
Week_03/G20200343030416/LeetCode_122_416.rb:10
← previous
next →
3,801–3,900 of 5,772, ranked by callers