Best Time to Buy and Sell Stock with Transaction Fee
来源:互联网 发布:windows官网下载win10 编辑:程序博客网 时间:2024/05/18 02:50
Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.
You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction. You may not buy more than 1 share of a stock at a time (ie. you must sell the stock share before you buy again.)
Return the maximum profit you can make.
Example 1:
Input: prices = [1, 3, 2, 8, 4, 9], fee = 2
Output: 8
Explanation: The maximum profit can be achieved by:
Buying at prices[0] = 1
Selling at prices[3] = 8
Buying at prices[4] = 4
Selling at prices[5] = 9
The total profit is ((8 - 1) - 2) + ((9 - 4) - 2) = 8.
Note:
0 < prices.length <= 50000.
0 < prices[i] < 50000.
0 <= fee < 50000.
https://discuss.leetcode.com/topic/107998/most-consistent-ways-of-dealing-with-the-series-of-stock-problems
- Best Time to Buy and Sell Stock with Transaction Fee
- Best Time to Buy and Sell Stock with Transaction Fee
- Best Time to Buy and Sell Stock with Transaction Fee
- 714. Best Time to Buy and Sell Stock with Transaction Fee
- LWC 55:714. Best Time to Buy and Sell Stock with Transaction Fee
- weekly contest 55 Best Time to Buy and Sell Stock with Transaction Fee
- Leetcode算法学习日志-714 Best Time to Buy and Sell Stock with Transaction Fee
- LeetCode714. Best Time to Buy and Sell Stock with Transaction Fee
- leetcode 714 Best Time to Buy and Sell Stock with Transaction Fee
- LeetCode #714 Best Time to Buy and Sell Stock with Transaction Fee
- LeetCode算法问题10 —— Best Time to Buy and Sell Stock with Transaction Fee
- 714. Best Time to Buy and Sell Stock with Transaction Fee
- 714. Best Time to Buy and Sell Stock with Transaction Fee
- Best Time to Buy and Sell Stock with Transaction Fee[LeetCode 714]
- Best Time to Buy and Sell Stock with Transaction Fee问题及解法
- [LeetCode] Algorithms-714. Best Time to Buy and Sell Stock with Transaction Fee
- [LeetCode] DP之 Best time to buy and sell stock with transaction fee
- leetcode练习 714. Best Time to Buy and Sell Stock with Transaction Fee
- SpringBoot37-分布式系统开发-基于Docker部署3
- Android Studio 如何快速添加override或者implements方法
- codeforces-886-E. Maximum Element(Технокубок 2018
- 期望和平均值有什么区别
- Linux命令之CD
- Best Time to Buy and Sell Stock with Transaction Fee
- Java单例模式学习
- bigdata-01
- register_chrdev函数
- bigdata-02
- 全排列(自己版本)
- 浅入了解深度学习&&机器学习&&模式识别
- bigdata-03
- poj 1201 Interval