News for hackers. Stuff that matters.
Re:Interviewing programmers: coding test example explained by huherto on Thursday June 03, 2010 @11:09AM (#1401503)
His solution is so similar to mine that is scary. I also went thru the same optimization process. (e.g started with a while and changed that to a for later) I didn't go farther because I didn't want to loose readability.

  void condense_by_removing(
      char *z_terminated ,
      char char_to_remove
      ) {
        char *rptr = z_terminated; // read ptr
        char *wptr = z_terminated; // write ptr
        for(;*rptr; rptr++) {
                if (*rptr != char_to_remove) {
                        *wptr++ = *rptr;
                }
        }
        *wptr = 0;
  }

There are no comments on this comment yet.