I have the set of matching pairs say p[0]=(0,1),p[1]=(1,2),p[2]=(4,0),p[3]=(0,5),p[4]=(2,4),p[5]=(3,3),p[6]=(5,1),p[7]=(1,7),p[8]=(2,6)
now,I want to print those pairs whose sum is same but the difference between
the elements of each pair is minimum.
i.e. say p[4],p[5],p[6] have the same sum 6.
the difference of elements in p[4] is 2 ,in p[5] is 0 & in p[6] is 4.
so we will choose p[5].
the result should print p[1],p[2],p[3],p[5],p[8].
I am trying but not get the results
code.txt (4.5K)
: 5.
now,I want to print those pairs whose sum is same but the difference between
the elements of each pair is minimum.
i.e. say p[4],p[5],p[6] have the same sum 6.
the difference of elements in p[4] is 2 ,in p[5] is 0 & in p[6] is 4.
so we will choose p[5].
the result should print p[1],p[2],p[3],p[5],p[8].
I am trying but not get the results
code.txt (4.5K)
: 5.