Print N distinct numbers following the given operations | Function to print the required array ; Check if number is a multiple of 4 ; Printing Left Half of the array ; Printing Right Half of the array ; Driver code
def printArr ( n ) : NEW_LINE INDENT if ( n % 4 == 0 ) : NEW_LINE INDENT for i in range ( 1 , ( n / 2 ) + 1 ) : NEW_LINE INDENT print ( i * 2 , end = " ▁ " ) NEW_LINE DEDENT for i in range ( 1 , n / 2 ) : NEW_LINE INDENT print ( i * 2 - 1 , end = " ▁ " ) NEW_LINE DEDENT print ( n + n / 2 - 1 , end =   " " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " - 1" ) NEW_LINE DEDENT DEDENT n = 22 NEW_LINE printArr ( n ) NEW_LINE