Ad
  • Default User Avatar

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

  • Default User Avatar

    Potential Unicode issue: if the string contains Unicode surrogate pairs (i.e. supplementary characters, like emoji and rare characters), this approach reverses those and produces a string with invalid/unintended characters. Solutions with StringBuilder#reverse() preserve the surrogate pair ordering, which is likely what you want in code.