摘要:        
https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-iii/description/ 这一题较难,难点是状态比较多,需要考虑两笔交易,则共5个状态需要被记录,用当前是否持有股票来划分子集进行计算 class Solution {     阅读全文
posted @ 2024-09-06 01:53
风乐
阅读(13)
评论(0)
推荐(0)
        
            
        
        
摘要:        
https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-ii/description/ class Solution { public: int maxProfit(vector<int>& prices) { vector<int>    阅读全文
posted @ 2024-09-06 00:39
风乐
阅读(7)
评论(0)
推荐(0)
        
            
        
        
摘要:        
https://leetcode.cn/problems/best-time-to-buy-and-sell-stock/ 经典股票题,此题有贪心做法 class Solution { public int maxProfit(int[] prices) { int res = 0; int min    阅读全文
posted @ 2024-09-06 00:13
风乐
阅读(24)
评论(0)
推荐(0)
        

浙公网安备 33010602011771号