start from rightmost digit find:i th positionsuch that ele[i]!=9 find j th position< i&& ele[j]!=0 decrement jth position element and increment i th position element. . . ex:ele=134 i=0,--->no j found i=1,j=0 ==>143 ele=23998 i=0,--->no j found i=1,--->ele[i]=9 i=2,--->ele[i]=9 i=3,j=0 ==>24997 ele 8000100 i=2 -->no j found i=3 j=2; ====>8001000
-- 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.