What i am missing in python


#1
indent preformatted text by 4 spaces`class Solution:
# @param A : list of integers
# @return an integer
def solve(self, A):
    n=len(A)
    ans=0
    for i in range(n-1):
        for j in range(n,i+2,-1):
            c1=A[i:j].count(1)
            c0=A[i:j].count(0)
            if c1-c0==1:
                ans=max(ans,j-i+1)
    
    return ans

`