Driver code
var N = 5 ; var arr = [ 1 , - 1 , 2 , 3 , - 2 ] ; replacedArray ( N , arr ) ; printArray ( N , arr ) ; N = 6 ; var arr1 = [ - 3 , - 4 , - 2 , 5 , 1 , - 2 ] ; replacedArray ( N , arr1 ) ; printArray ( N , arr1 ) ;