[algogeeks] Re: Microsoft Interview Question

2012-06-21 Thread Anchal Gupta
@akshat ur code doesn't give intact output, so i modified ur code and here is the code : int j=0,k=0; for (i = 0; i n; ++i) { if(a[i]0) { a[j] = a[i]; j++; } else { temp[k] = a[i]; k++; } } k=0; for (i = j; i n; ++i) {

[algogeeks] Re: MS question : string compression

2012-05-26 Thread Anchal Gupta
, 2012 at 11:31 AM, Anchal Gupta anchal92gu...@gmail.comwrote: hey, here is the function that do the compression and store the output in an array op. void str_comp(char *str) {  int count=0,j=0,i;  char ch,op[100];  for(i=0;istrlen(str);)  {    ch = str[i];    while(str[i