Find maximum length of array where every entries are the same Is the complexity of this code \$O(n^3)$? How can I improve the efficiency and reduce the complexity?

A = [3,2,4,2,4,2,4,5,3]
n= len(A)
def ALG2 (A,i,j):  #to check whether all entries between A[i] and A[j] are the same
    if i==j:
        return True     
    for k in range (i,j-1):
        if A[k] != A[k+1]:  
            return False
    return True

def  ALG1(A,n):   #find the max length of the arrays that are found in ALG2 
    l=0
    for i in range (0,n-1):
        for j in range (i+1,n-1):    
            if ALG2(A,i,j) and (j-i)&gt;l:
                l= j-i

    return l

result = ALG1(A,n)



print (result)
You should use better function names ALG1 and ALG2 don't really say what they're performing.
You should keep the creation of A, n and result at the bottom of your code.
You should keep your 'main' code in a main guard block:

if __name__ == '__main__':
    A = [3,2,4,2,4,2,4,5,3]
    n= len(A)
    result = ALG1(A,n)
    print(result)

You should follow PEP 8, so that it's easier for others to read your code.
ALG2 can be simplified by slicing the array from i to j, A[i:j], and then checking if the set has a size of one.

def ALG2(A, i, j):
    return len(set(a[i:j])) == 1

Your entire code can be drastically simplified by using itertools.groupby.

import itertools


def ALG1(array):
    sizes = (
        sum(1 for _ in g)
        for _, g in itertools.groupby(array)
    )
    return max(sizes, default=0)