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.

  • 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

    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

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

  • 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