Ad
  • Custom User Avatar

    C# is for the bigger and bolder.

  • Custom User Avatar

    You missed the point I was trying to make. It doesn't matter how you write it, with an if block, or with a ternary, or using min, max, the performance difference is miniscule between all of these methods. If someone sat you down in front of this solution and told you to optimize it, and you changed the min, max variable assignments to if blocks, then you would have failed the task. Nobody cares that one of these is a few hundred microseconds faster than any of the other ones.

    Your claim that changing the code to what you've written above will "shave off a third of the execution time" is only true for a small range of (a..b) due to the speed of the rest of the solution. In other words, if you run the original solution at the top of the page with very large inputs (like 0, int.MaxValue / 2) and compare it to one where you've replaced the variable assignments with your ternary expressions, your ternary assignment one no longer shaves off a third of the execution time (It will likely only shave off like .00002% of the execution time, if anything).

  • Custom User Avatar

    Wow I don't even know what to say. I cannot believe that this phony "2 dan" user "Blind For Basics" (heh) could make such elementary errors about the BASICS of programming. I don't see what's so hard about KISS either, everyone knows Gene Simmons hates LINQ.

  • Custom User Avatar
    • the solution's code is not visible to any user who didn't solve the kata yet
    • any user can see any comment posted under any solution on their dashboard
    • a comment without the spoiler flag is visible to any user, even if they didn't solve the kata yet (on the dashboard and in the solution's page)
    • with the spoiler flag, the comment content is hidden on the dashboard and in the solution's page (but users who land here and have solved the kata can read their content)
    • On easy problems pretty much anythig in the comment that contains code can be considered a spoiler.

    Is that clearer?

  • Custom User Avatar

    BTW, that's not the usual meaning of KISS so you've basically been calling stupid to everyone you said KISS without your intended meaning, so you know.

  • Custom User Avatar

    Ok, could you please refrain from posting messages that overall do not really make sense or are mostly there to "bitch" at other users? (...who you don't even know)

    For example, KISS is the opposite of micro optimizations. Talking about both in the same sentence/§ is just none sense.
    Second, the tone used will just attract epidermic reactions on you from any reader (just look at the downvotes on your message).
    Third, By reading some of your other messages here or there, I can tell you don't fully understand yet the difference between Big O and actual runtime, how to manipulate those notions and in what context, to stay meaningful, or how to test the actual performances of a solution (...and talk about it: announcing a time without explanations about how it was measured, with what inputs, how many tests, ... is just a waste of... time).

    Overall, you're obviously focussing way too much on the wrong things, for now, considering your programming journey.

    Some users posted interesting answers to some of your previous messages, but I doubt you saw them because they are flagged as spoilers. You might want to go check for them (you can find them through your profile "discourse" page).

    Have a good day & cheers

  • Custom User Avatar

    spoiler flag, please. The comments are visible from the dahsboard.

  • Custom User Avatar

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

  • Custom User Avatar

    If you have a billion-character string then calling ToLower() on it will create another billion-chararacter string. Most likely, it will be slower to create this second string than calling Char.ToLower() for each character twice.

  • Custom User Avatar

    It will still run it once for every character under the hood.