Ad
  • Custom User Avatar

    two for loops has a time complexity of O(n^2), while this approach only takes O(n).

  • Custom User Avatar

    I've tested the two approaches with 10000 numbers and the 2 loop approach was 65 ms, this one was 8 ms, so 8x faster. I've done it with an object, which is just as fast as a map in this case.

  • Custom User Avatar

    I left in an unused variable :(

  • Custom User Avatar

    Bro made fmt-less solution 😎

  • Custom User Avatar

    Would two for loops not have been faster?

  • Custom User Avatar

    Thanks, I was doing a bunch of these as practice for basic understanding and to be able to explain things. Coming from the Javascript eco system where everything is abstracted away I felt super weak on the HOW and WHY things worked.

  • Custom User Avatar
  • Default User Avatar

    I like your solution it takes really small amount of time in comparison with string format operation. My solution takes 3-4 times more than yours 🙂 but current one with string format takes 2-3 times more than mine 🙂. String formatting really heavy operation even in this case when we have to format 10 numbers only

  • Custom User Avatar

    @Kirby Douglas Ellingson, since you want this site to live up to its potential, why don't you engage in the meta community, in Discord, on Github, in the kata and translation reviewing process, and so on? We could use some Eternal Optimists ;)

  • Custom User Avatar

    You are ablsolutelly correct @IThinkThatsKirby. Nonetheless, the goal of the Codewars project is not to teach that or another language (AFAIU from ToC), but to give a platform. You are right, some warriors provide comments to their solutions, however that's not the rule.
    In case you are eager to find explanetions to solutions, you might google it. There are some on YouTube, GitHub, dev.to, etc.
    At least, I put my point of view at this topic.

  • Custom User Avatar

    I am sorry, I meant, where is the code comments explaining what this does. What i really really ment was, why is this website not living up to my expectations. I see no code comments and single letter variables EVERYWHERE and it's up voted as best practices instead of clever. I am Eternal Optimist and it's like nails on a chalkboard to me. I want this site to be more than it is, I want this site to be what it could be. But back on topic. A line code explaining which way it sorts and how would be nice and best practice.

  • Custom User Avatar

    Thank you for this feedback, I've been wondering where the sweet spot of documentation is. I've had the idea of explain like no one has any idea what anything does. But it does seem to annoy seasoned developers. I've been playing with the idea of writing comments on blocks of code instead. My level of discernment is not high enough to figure out what doesn't need be said, yet.

  • Custom User Avatar

    Would you please be so kind to eleborate your stayement, namely "where [is the] documentation."?
    I am not absolutely sure that I am clearly understand you.

  • Custom User Avatar

    Looking at your solution it looks like you just like to add documentation for the sake of documentation, even when it results in illegible code and a ton of duplication/stating what is obvious even to novices. I won't claim the top solution to be best practices, but less is more in this case when the solution can be whittled down to a single standard lib function call.

  • Custom User Avatar

    i left a PRINTLN in D:

  • Loading more items...