Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I meant to entirely replace StringBuilder by new String(value, 2);

  • Default User Avatar

    I would have to profile it to see how significant the difference is, but calling new String just to produce a two-character string, append it to a StringBuilder, and then throw it away to be garbage collected later might be more wasteful, of memory certainly, but possibly also of CPU, than two calls to Append. StringBuilders are optimized for many small incremental additions...they try to minimize the number of memory allocations. But making new objects over and over again to hold two bytes of data seems like the worse decision to me.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution