from typing import List


class Solution:

    def maxProfit(self, prices: List[int]) ->int:
        res = 0
        n = len(prices)
        if n < 2:
            return res
        for i in range(1, n):
            if prices[i] > prices[i - 1]:
                res += prices[i] - prices[i - 1]
        return res


so = Solution()
print(so.maxProfit([1, 5, 3, 4, 5]))

eb1fb19337f8d5ba228c33e9e0fefe919943b32a
<mask token>


class Solution:
    <mask token>


<mask token>

<mask token>


class Solution:

    def maxProfit(self, prices: List[int]) ->int:
        res = 0
        n = len(prices)
        if n < 2:
            return res
        for i in range(1, n):
            if prices[i] > prices[i - 1]:
                res += prices[i] - prices[i - 1]
        return res


<mask token>
print(so.maxProfit([1, 5, 3, 4, 5]))

<mask token>


class Solution:

    def maxProfit(self, prices: List[int]) ->int:
        res = 0
        n = len(prices)
        if n < 2:
            return res
        for i in range(1, n):
            if prices[i] > prices[i - 1]:
                res += prices[i] - prices[i - 1]
        return res


so = Solution()
print(so.maxProfit([1, 5, 3, 4, 5]))

from typing import List


class Solution:

    def maxProfit(self, prices: List[int]) ->int:
        res = 0
        n = len(prices)
        if n < 2:
            return res
        for i in range(1, n):
            if prices[i] > prices[i - 1]:
                res += prices[i] - prices[i - 1]
        return res


so = Solution()
print(so.maxProfit([1, 5, 3, 4, 5]))
