You can do it using stack concept:-- Pop the element from the end , taking two variable index1, index2 and Ch(character to Iterate)
Eg:- a1b4 .... here index1=4 , Ch='b', index2=1; Start filling the element of Ch from the extreme end of the array .. >From right hand side . The array will look like this :- a b b b b In next iteration : Index1=index2,ch=a, index= no value( Underflow) repeat the same process giving:- a b b b b. (soln). Add element at the end .. Like character 'b' is added from the Right hand end of the array . If any bug in my approach ... comments me ... -- 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.