@ divya,

Your soln will nt always work.
Suppose the array like
12,7,1,2,14,3,2,9

as per ur approach u will end up getting

A: 12,3,2,9
B: 7,1,2,14

sum diff : 26-24 =2

but one soln is

A: 12,1,3,9
B :7,2,14,2

sum diff: 25-25 = 0

I think DP is the fastest sol for this as suggested by Rohit.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to