initial commit
This commit is contained in:
commit
942e4e2dc1
30 files changed
+297
No files matched your search
@@ -0,0 +1,11 @@
|
||||
#include <vector>
|
||||
|
||||
inline int maxProfit(std::vector<int> &prices) {
|
||||
int profit = 0;
|
||||
for (int i = 1; i < int(prices.size()); i++) {
|
||||
if (prices[i] > prices[i - 1]) {
|
||||
profit += prices[i] - prices[i - 1];
|
||||
}
|
||||
}
|
||||
return profit;
|
||||
}
|
||||
Reference in new issue
Block a user