Ad
  • Custom User Avatar

    Description should be language-agnostic.

    Particular encodings should be generalised over; for the description, focus on underlying concepts instead of language-specific encodings. Eg, "std::vector [1,0,1]" should just be "list of bulb states [true,false,true]".

    Note: a bulb state is not 0 or 1, it's on or off, so it should be encoded as an Enum, or maybe a Boolean. If your language doesn't have Enums or Booleans, specify the encoding in the initial solution or a language-specific block. Use appropriate datatypes!

  • Custom User Avatar

    There's a similar kata, but it's much more complicated. I don't think this is a direct duplicate.

    That said, if there was a duplicate in another language, this kata would have to be a translation on that kata, not a separate C++ one. But as said, I think that's not applicable.

  • Custom User Avatar

    Dammit now it got unpublished. Author, when you've fixed @monadius' issue, resolve that issue as well and ( then ) you'll need to republish.

    ( See what happens when you have 5 language versions on a Beta? )

  • Custom User Avatar

    Not seeing it. I still see

    const n = Math.floor(Math.random() * (upperBound - 10) + 10);  // Length of the mountain array
    

    What I would want to see as a maintainer is something like

    const n = rnd(10,upperBound);
    
  • Custom User Avatar

    Kata is approvable, but with all the language versions not all have been tested adequately, or even solved at all.

    Please resolve this issue when all languages have been tested, or at least reviewed, and the kata will be approvable again.

    Python and JS have been solved several times; they're probably OK.
    C++ could probably use some attention.
    Rust and Java probably need a review.

  • Custom User Avatar

    ( JS, possibly others )

    Please factor out the generation of random numbers from your random tests. This is not maintainable. Use a library or your own custom wrapper, but use something where you can just pass in lower and upper bounds.

    Sometime, somebody is going to have to maintain this code and will thank you for writing it in a readable way. ( That somebody might be you in six months. )

  • Custom User Avatar

    Is this effectively a duplicate of https://www.codewars.com/kata/55ee3ebff71e82a30000006a/ ( and thus should be a translation rather than its own kata ) ?

    Note: The question is not "is this exactly the same problem?" but "is this the same problem up to input and/or output encoding, without greatly differing performance requirements?"

  • Custom User Avatar

    Nice!

    How was using negabinary for you?
    Do you think it's better than just using signed magnitude would be, or is it over the top? It makes some things more complex, and others less, than in signed magnitude, but is it overall a good encoding, is it a good trade-off?

  • Custom User Avatar

    Well, it definitely seems to pass all the tests. :]

    This kata is turning out much more interesting than I imagined when I first clicked on it. There are just so many different solutions. And you may have found the simplest. I don't think it can be done in less than three comparisons.

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

    Look, no zero case!

    ( at the expense of iterating the list )

  • Custom User Avatar
  • Custom User Avatar

    Correct. Node 8.x didn't have that yet. Maybe, one day, the kata will be upgraded to a Node version that does. Until then, you'll have to roll your own .flat.

  • Custom User Avatar

    This is an old kata, running an old version of NodeJS. At some point it'll probably get upgraded; until then, roll your own .flat because it is unsupported.

    All arrays are objects in JS.

  • Loading more items...