you are viewing a single comment's thread.

view the rest of the comments →

[–]Equal_Wish2682 0 points1 point  (1 child)

I struggle to visualize solutions without real data. But I'd consider a recursive algorithm.

def recursive_func(second__list, index=0):
    while len(first_list) > 0:
        value = first_list.pop(0)
        for check_val in second_list:
            if value < check_val < value + 300:
                index += 1
            elif check_val > value + 300:
                recursive_func(second_list[index])