from typing import List
from typing import Generator


def indices_generator(start_list: List[int], end_list: List[int]) -> Generator[List[int], None, None]:
    """
    Loop from the start_list to the end_list by only incrementing the last value by 1.

    Example::

        indices_generator([0, 1, 0], [2, 3, 2])
        # Returns:
        [0, 1, 0]
        [0, 1, 1]
        [0, 1, 2]
        [0, 2, 0]
        [0, 2, 1]
        [0, 2, 2]
        [0, 3, 0]
        [0, 3, 1]
        [0, 3, 2]
        [1, 1, 0] Min index for list[1] is 1
        [1, 1, 1]
        ...
        [2, 3, 2] The last returned list
    """
    copy = start_list.copy()
    yield copy
    last_index = len(copy) - 1

    def increment_by_one_at_index(my_list: List[int], start_list: List[int], end_list: List[int], index: int):
        """ Returns True if incremented successfully, False if end was reached """
        if index < 0:
            return False
        my_list[index] += 1
        if my_list[index] > end_list[index]:
            my_list[index] = start_list[index]
            return increment_by_one_at_index(my_list, start_list, end_list, index - 1)
        return True

    while 1:
        incremented = increment_by_one_at_index(copy, start_list, end_list, last_index)
        if not incremented:
            return
        yield copy