Professional Documents
Culture Documents
CM
CM
n = len(A)
res = dp = -1
for i in range(1, n):
if dp > 0 and A[i] == A[i - 2]:
dp += 1
else:
dp = 2 if A[i] == A[i - 1] + 1 else -1
res = max(res, dp)
return res
if a > b:
return a
else:
return b
# Initialize result
res = 1
return res
# Driver Code
arr = [10, 22, 9, 33, 49, 50, 31, 60]
n = len(arr)
if a > b:
return a
else:
return b
# Initialize result
res = 1
return res
# Driver Code
arr = [10, 22, 9, 33, 49, 50, 31, 60]
n = len(arr)