Iterate for the first sub - array and store the maximum
while ( i < M ) : NEW_LINE INDENT if A [ i ] in m : NEW_LINE INDENT m [ A [ i ] ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT m [ A [ i ] ] = 1 NEW_LINE DEDENT val = max ( val , m [ A [ i ] ] ) NEW_LINE i += 1 NEW_LINE DEDENT