#include inline int maxProfit(std::vector &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; }