def lc_candies(ratings_list):
    """
    From: https://leetcode.com/problems/candy

    There are N children standing in a line. Each child is assigned a rating value.
    You are giving candies to these children subjected to the following requirements:

    - Each child must have at least one candy.
    - Children with a higher rating get more candies than their neighbors.

    What is the minimum candies you must give?
    Examples:

    >>> lc_candies([0])
    1
    >>> lc_candies([2, 1])
    3
    >>> lc_candies([1, 3, 7, 2, 1, 3, 5, 2, 4])
    17
    """

    class Solution(object):

        @staticmethod
        def candy(ratings):

            candies = [1] * len(ratings)
            for cnt in range(1, len(ratings)):
                if ratings[cnt] > ratings[cnt - 1]:  # left 2 right
                    candies[cnt] = max(candies[cnt], candies[cnt - 1] + 1)

            for cnt in range(-2, -len(ratings) - 1, -1):
                if ratings[cnt] > ratings[cnt + 1]:  # right 2 left
                    candies[cnt] = max(candies[cnt], candies[cnt + 1] + 1)

            return sum(candies)

    return Solution.candy(ratings_list)