*****************************************************************************
time = O(n)
space = O(1)
Took a greedy approach and started with 2,4 6,8,...
maintain two numbers :
1) currSum : which will be increased by 2 , in every iteration
2) FinalSum = which will be decrease by currSum every iteration
For eg finalSum = 28 , the two arrays will look like below
currSum 0 2 4 6 8
finalSum 28 26 22 16 8
we need to stop the look when currSum == finalSum ( ie when both values are 8). At this point, we have added 2, 4, 6, into our array
now the only number that is left to make finalSum = 0 is16 , which is currSum + finalSum ( 8+8), so we add 16.
this our array becomes 2,4,6,16
Code below