solution may be
array ={ 3 ,21 ,9 ,93,17 ,178 ,1,101} (i think i have covered all exceptions ) then ,change this array like 33333 , 21222, 99999, 93999, 17111, 17811, 11111 , 10111 ( make each number of 5 digit with rest digits same as Ist digit ) then sort this array 99999, 93999,33333 21222, 17811,17111, 11111, 10111 and make it with actual numbers 9,93,3,21,178,17,1,101 = 993321178171101 plz let me know if any case left... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.