Solution exists if GCD of array is equal to the minimum element of the array
if ( GCD_of_array == arr [ 0 ] ) : NEW_LINE INDENT answer . append ( arr [ 0 ] ) NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT answer . append ( arr [ 0 ] ) NEW_LINE answer . append ( arr [ i ] ) NEW_LINE DEDENT DEDENT