(extremely sorry , made a mistake in providing the information, edited )

I did something similar to wat most of the guys did, but i got a ‘wrong answer’ .

It did the following :

i made 5 groups of number ( in string A)

a----- no>7

b-----no==7

c-----no<7 && no>4

d-----no==4

e-----no<4

(similar goes for B string too) ( v,w,x,y,z)

for every number greater than 7 (v)(in B string), i paired it up with nos in grp … a,c,e,d,b( in decreasing order of priority).

for every number == 7 (w)(in B string), i paired it up with nos in grp … c,e,d,b( in decreasing order of priority).

for 7<number<4(x) … e,d,c

n==4(y) … e ,d

(remaining numbers<4 don’t matter)

this was for numbers in B string … if any number is left in A string to be paired, similar order is used.

the crux is … to avoid 7’s and 4’s to be paired with any number higher then them … hence pair the higher number with useless numbers.

But i am getting wrong answer , could someone please point out the mistake in this algo.