Ad
  • Custom User Avatar

    I agree with this.
    But wouldn't it be nicer to get rid of tolower? One can use a switch and "hardcode" both ascii values for x and o respectively. Also we could omit the char *p since we can iterate on str, but that's very likely optimized away by the compiler anyway.

  • Custom User Avatar

    Same reaction, didn't know this existed... idk why but smh it feels wrong to use "easy" solutions with low level languages like c++ and java. Great answer nontheless.