Ad
  • Custom User Avatar

    Python translation:
    Check comment

    You might want to add that kind of thing as a test.

  • Custom User Avatar

    Done in this fork + Enabled Ruby 3.0

  • Custom User Avatar

    Gotta say, I don't really understand why this works the way it works intuitively, but people complaining that this isn't "best practice" or "uh muh readability", "maintainability", or "what about junior devs":

    This is a code exercise, not production code.
    Yes, in production you'd want better guard rails and input validation, and yes, you would want this documented to explain what it does. And yes, you'd need to validate that the ouput is sane since multiple odd occurances throws the math out the window lol (so maybe that would make this solution invalid for production as extra compute might outweigh the space benefits).

    However, as a general point you shouldn't sacrafice performance of something so simple with a very clear objective to write more convoluted looping code that will take a junior some time to parse anyway.

    If you know a clever way to do something that's performant, is little code, and achieves a clear focused objectives, you shouldn't dumb it down because someone might not get it. Let them figure it out, and learn, and make sure the rest of the codebase isn't impacted by someone not understanding a bit of code in it.

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    good, you're on the right track

  • Custom User Avatar

    Everyday I learned bizzare stuff from here

  • Custom User Avatar

    thanks guys, my bad

  • Custom User Avatar

    You probably confused d and b?

  • Custom User Avatar

    No, d is on right side.

  • Custom User Avatar

    alphabetWar("zdqmwpbs"); //=> Let's fight again!

    • left = 2+4+3+2+1 = 12
    • right = 1+3+4 = 8
    • should return left side win!, right ??
  • Custom User Avatar

    You are so full of yourself. You are in no position to tell people what they should and should not be proud of.

    Linq is the worst thing a beginner coder could ever learn.

    And who told you that OP, or anyone in this thread as a matter of fact, was a beginner? Everybody knows what 2.5x faster means. You didn't need to recite the entire hare and tortoise song-and-dance like you're talking to preschoolers. People know when they're being patronized, so have some tact.

    Since you're so intent on quoting things, want me to leave off with something?

    Premature optimization is the root of all evil.

    If LINQ is not a bottleneck, it is not a bottleneck. You are Dunning-Kruger personified.

  • Custom User Avatar

    I hope it's not a solution you're proud of. Linq is slow as a sloth in a tarpit. Very slow. Your code, while short (and maybe cool looking to those who care about looks over performance), is over 2.5 times slower than my plain, ordinary, "normal" algorithm.

    It's like if our code was in a race around a track, mine would go around more than 2 and 1/2 times before yours went around even once.

    Linq is the worst thing a beginner coder could ever learn.

  • Custom User Avatar

    Read the description again. There are letters that don't have point values assigned to them.

    From the description:

    The other letters don't have power and are only victims.
    
  • Loading more items...