Ad
  • Custom User Avatar

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

  • Default User Avatar

    The more lines of code you have means the more work you have done. More work done means better.

  • Custom User Avatar
  • Custom User Avatar

    Not sure it really is "best practice", this seems more of a joke. That said, it is quite performant because it iterates over the characters of the input exactly once, although in the grand scheme of things it is still a O(N) algorithm, so asymptotically it won't perform much better than other solutions that use Linq and iterate over the input multiple times.

    You should know that on Codewars, "best practice" and "clever" mean very little, as many votes tend to come from inexperienced users who don't really understand what the solution does or how it performs, but are "wowed" by it in some way and just give it their vote.

  • Custom User Avatar

    hey! I am a newbie so can anyone explain why this is considered to be best practices? And why other approaches with linq for example are not?