Find non | Python 3 program for the above approach . ; Function to find the possible output array ; Base case for the recursion ; If ind becomes half of the size then print the array . ; Exit the function . ; Iterate in the range . ; Put the values in the respective indices . ; Call the function to find values for other indices . ; Driver Code
N = 200 * 1000 + 13 NEW_LINE n = 0 NEW_LINE arr = [ 0 for i in range ( N ) ] NEW_LINE brr = [ 0 for i in range ( N ) ] NEW_LINE import sys NEW_LINE def brute ( ind , l , r ) : NEW_LINE INDENT if ( ind == n / 2 ) : NEW_LINE INDENT for i in range ( n ) : NEW_LINE INDENT print ( brr [ i ] , end = " ▁ " ) NEW_LINE DEDENT sys . exit ( ) NEW_LINE DEDENT for i in range ( l , arr [ ind ] // 2 + 1 , 1 ) : NEW_LINE INDENT if ( arr [ ind ] - i <= r ) : NEW_LINE INDENT brr [ ind ] = i NEW_LINE brr [ n - ind - 1 ] = arr [ ind ] - i NEW_LINE brute ( ind + 1 , i , arr [ ind ] - i ) NEW_LINE DEDENT DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 2 NEW_LINE n *= 2 NEW_LINE arr [ 0 ] = 5 NEW_LINE arr [ 1 ] = 6 NEW_LINE INF64 = 1000000000000000000 NEW_LINE brute ( 0 , 0 , INF64 ) NEW_LINE DEDENT