Omkar problem

Added: 2025-09-13 04:16:13

Question Image

Omkar problem

Answer

✏️ Edit
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    
    max_consecutive = 1
    current_consecutive = 1
    
    for i in range(1, n):
        if a[i] == a[i-1]:
            current_consecutive += 1
        else:
            max_consecutive = max(max_consecutive, current_consecutive)
            current_consecutive = 1
    
    max_consecutive = max(max_consecutive, current_consecutive)
    print(max_consecutive)