Ad
  • Custom User Avatar
  • Custom User Avatar

    In fact is amazing how this small detail made it possible to appear the amazing solution that I liked so much and that I managed to spoil so stupidly 🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️

  • Custom User Avatar

    oh...
    "oops", missed that one.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    But do you think it is different enough to keep it as a separate kata?

    Who's this question addressed to? As far as I can see, nobody's calling your kata "different" here.

    The idea of this one is performance

    Here - same problem, same performance requirements. Also, the easier katas already have many submitted O(n) solutions, so authoring a performance-oriented version is pointless anyway.

  • Custom User Avatar

    @KovDimaY: You definitely have a point that for a 7, required performance should not be a factor. To me, achieving the required performance is not difficult ( I guess I actually learned a thing or two in my time here ), but maybe 6 is appropriate. That will then be decided by community vote, wether I think it's a 6 or a 7. ( Which seems to be working! )

    @RottulXel: I don't think there's reason to be impressed ( let alone intimidated ) by my rank; I spent just going on five years on here hobbying. If that translates to not spending hours on this kata, or spending overly many perfectly good CPU cycles on it, well, I guess I learned something. :P But you're free to disagree with my ranking, and most people do. :] You're even free to vote it blue, and then most people would disagree with you as well. :D

    Ranking kata is not an exact science! There's an article on ranking kata here. Some mods will tell you utterly seriously that you should not be taking that seriously, but it's the only guidance we have. Or you could invent your own kata ranking scheme, and maybe even publish it ( Somebody did that. I don't remember where they published it - but basically everything is an 8. Also, everything sucks and is unsatisfactory ). Note that performance requirements are not in the existing guidelines, but you can just add a rank, or two, or four ( depending on difficulty before and after ), to the base rank. There are plenty of yellow kata that have some sort of performance requirement BTW. You may not have encountered them, but I definitely have. Not all performance requirements are equally strict, nor equally hard to achieve; there's a lot of variation there.

  • Custom User Avatar

    Well, is easy for you (man, you have 5K katas solved 🤯 😅) but I think for other people it will be not so obvious to find a solution that passes all the tests 🤷‍♂️

  • Custom User Avatar

    No.

    This opinion worth what you paid for it. :P

    Ask a mod or an admin for a more authoritative opinion. I just stay here, I don't own the house.

    ETA: Required performance is a mitigating factor. I don't know what performance the other one requires, but frankly, with an O(n log n) solution of two short, simple lines possible, I'm not particularly impressed with this kata's performance requirements. Not saying the performance requirement isn't there, just saying I don't think it's hard to satisfy, or unreasonable to ask for.

  • Custom User Avatar

    I am generally not a fan of forcing a particular implementation, and especially not by restricting available language features. ( Nor am I a fan of trying to increase difficulty setting restrictions, but I think that's not the case here. )

    A kata can measure output correctness, and it can measure time complexity ( with careful test design ). If you cannot distinguish by way of either of those, the particular implementation apparently is as good as your favourite one. ( Ignoring space complexity here for simplicity. )

    I would not say this kata just tests knowledge of JS syntax. It tests problem analysis and modeling, in light of available language features. If you can use fast datatypes to solve a particular problem, I think that's OK.

    Maybe part of a solution to your problem is allowing duplicates in the input or output? That would make the available fast JS feature less useful. ( I haven't fully thought this through - that's your job! :P )

  • Custom User Avatar

    Nice solution! 👏

    Be aware that array.push and array.sort are mutating input and this can be dangerous for the app that may use this function. Is better avoiding mutations in JS 👍

    But the approach is nice! Is almost the same as I used for my solution! 🙌

  • Custom User Avatar

    But do you think it is different enough to keep it as a separate kata? 😕

    UPD: I just checked the tests and the solutions of the kata that mentioned @natan and it seems it has completely different idea (I think).
    The idea of this one is performance. In that kata of @natan it does not matter because all the usual O(n2) solutions will pass without problems and here in my kata O(n2) solution does not have any chance to pass.
    So people should figure out the approach which will end up being more performant than a naive O(n2) one that any normal person would use for a problem like this 🤷‍♂️

  • Custom User Avatar
  • Custom User Avatar

    Thanks! Hehe, well, that was the idea that a naive solution should not pass 😅

  • Custom User Avatar

    Hey, hey, guys, please! No reasons for the agression! 🙏

    Everyone has his opinion and it is ok! I assume such beta states are supposed to get suggestions from different people and decide the final dificulty based on that, no?
    But what I do not want is people offending each other because of different opinions, otherwise is better just delete that kata and that is all! 🤷‍♂️

    I agree with guys that probably 7 kuy is a bit too low for this kata as based on my experience this level normally assumes that any naive solution will work. In this case if someone does not know the trick you (@JuanM and @JohanWiltink) used in your solution, they will have hard times trying to find out what is going on and how to improve the performance. I personally know several people who are professional middle+ developers who spend a significant amount of time trying to solve this kata and it did not come easy for them.

    But idk, if everyone agrees to put 7 here I do not mind 🤷‍♂️

  • Loading more items...