Input array: [-2,1,3,5,6,7,8,10,12,15,17,19,20] Sum : 20
Output
6, 12 3, 15 1, 17 -2, 20 8, 10
Required best time complexity and effective code