Ad
  • Custom User Avatar

    there's no need to actually have the numbers all at once, i.e. no need for the vector at all.

    even with SSO eliminating heap usage, using to_string is much more work than necessary, when a simple loop and modulus operation works fine.

  • Custom User Avatar

    small string optimisation means that this should (probably?) never allocate on the heap.
    I dont think this answer is best practice, but this comment thread starter is about as mislead as they thought the answer was.