Solution 1: need two scan : start from left and replace one by one by non-space character ( thus have minimal replacemnt)
count =0; for (int i=0;i<len(str);i++) { if(str[i] !=NONSPCECHAR) { str[count++]=str[i] } } ps: any way it needs Left shift...and all solution must need left shift if you try to compact it in lower index area. On 10/11/11, abhishek sharma <abhishek.p...@gmail.com> wrote: > Can in place compaction be done without left shifts? > > > > -- > Nice Day > > Abhishek Sharma > Bachelor of Technology > IIT Kanpur (2009) > > -- > 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. > > -- Thanks and Regards, ------------------------------ **DIPANKAR DUTTA Software Development Engineer Xen Server - OpenStack Development Team (DataCenter and Cloud) Citrix R&D India Pvt Ltd 69/3, Millers Road, Bangalore – 560052 Phone: +91 8147830733 Office: Extn: 16429 Email: dipankar.du...@citrix.com -- 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.