find xor of all elements - if its equal to zeo then Case has solution otherwise NO for finding the soltuion just sort all the elements and find the (sum of all -sum of smallest)..
On Sun, May 8, 2011 at 9:50 PM, Kunal Patil <[email protected]> wrote: > Can anybody tell me How to solve candy splitting problem appeared in Google > Code Jam Qualification round? > I know there is solution, if XOR of all elements comes to be zero. > But i wasn't able to proceed from there as I couldn't think of way how to > partition that elements. > (I have read solutions from other contestants but as expected they are > dirty for the one who doesn't know logic behind program) > So plz help... > > -- > 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. > -- Kumar Anurag -- 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.
