In [1]:
def furthestEqual(lst: list) -> int:
    if len(lst) == 0:
        return 0
    if lst[0] == lst[-1]:
        return len(lst) - 1
    l = furthestEqual(lst[:-1])
    r = furthestEqual(lst[1:])
    if l > r:
        return l
    else:
        return r
    
print(furthestEqual([2, 1, 1, 2, 3]))
3