Ad
  • Custom User Avatar

    Thanks. I thought I could let you some space to comment a bit my changes and let you add more improvements before approving it. I believe the essence of coffeescript is to be more succint and get rid of some the dispensable syntax of javascript, but style is so subjective...

  • Custom User Avatar

    Hi Keozon. I confess I've been practically absent in the past year :(, but I still read my mails.
    If you decide to translate this kata in Rust, I'll be glad to aprove it. I have no experience in Rust, but I think I'll be able to read it anyway.

  • Custom User Avatar

    Hi kayahr,
    Is it possible that your array has some extra "null" cells? Can you test for array dimensions and see if it's what expected?
    If my clue didn't lead you anywhere, can you please post your code (marking it as spoiler)?
    Thanks

  • Custom User Avatar

    Hi Tyguy7,

    Yes, in the Discourse section, your solution seems incomplete, but in the Solutions page, it's complete and works fine...

  • Custom User Avatar

    Well, in the reduce statement (could use also a foreach) I build an array where I place a dot in every corresponding index of the intervals (the for loop inside). In that way, overlapping intervals will, in the worst case, overwrite an existing dot. Then, I build a string from that array (indexes without dots will produce no character at all), and simply get the length of that string.
    Not properly orthodox, but works fine :P

  • Custom User Avatar

    Thanks, and you are pretty right.
    One char vars are good only in minified code. When I first wrote this solution, Codewars didn't have the "Best Practice" upvote. Many of my solutions were focused in starting the function body with "return" as a self imposed extra challenge, and keeping them as compact as possible (I believe none will ever have a best practice upvote :)).

  • Custom User Avatar

    It's still difficult to understand the requirements. Something like "Given an unordered array with the positions of the lit bits in a 32 bit integer, least significant bit first, return the corresponding integer" is probably more direct and concise. The emphasis given to the fact that you can use that to sort the array is misleading (this can be eventually the subject of another kata: return the sorted array using a bitset, and I percieve this was maybe the original intention).
    Also, the order you put the params in the Test.assertEquals method are inverted: “given” comes before “expected” otherwise the output in case of failure produces sentences like “Test Failed: Expected: , instead got: ”.

  • Custom User Avatar
  • Custom User Avatar

    Hi nha, well, I believe I'm too late to apply a regex to the function body and strip out comments. I think it isn't worth the risk of an accidental solution invalidation. You still can place your comments outside the functions body :).
    As for the segment1 given solution, you are right. I've corrected the preloaded solution giving the more accurate and meaningful segment7 solution.
    Thank you for the hints.

  • Custom User Avatar

    Just a little misleading comment on your description:

    Mongo.isValid('507f1f77bcf86cD799439011') // true we consider that only small letters can be in the string. This is rather arbitrar approach.
    

    should be false, according to the tests... :)

  • Custom User Avatar

    Nice kata, but maybe too close to the The Look and Say sequence...

  • Custom User Avatar

    Hi freizl, I'm sorry to signal you some little issues:

    1. I've got a prod and prodRec as undefined reference error (had to define these two variables myself)
    2. The request of a recursive implementation of sum and prod isn't too much clear: I guess the exercise is to use also foldl for the recursive form.
    3. Your solution for the 'join' method is different from the native join: with an array of n empty strings, you would return an empty string whereas native join would return a string made of n-1 delimiters.

    Once corrected, this kata makes a pretty bridge to Haskell :) (I suggest to mention that too!)

  • Custom User Avatar

    Good job! Now the kata makes sense :P

  • Custom User Avatar
    Test.expect(validWord(['cod', 'dewa', 'ars'], 'codewars') === true or false ?);
    

    In the latter case, my solution breaks :(

  • Custom User Avatar

    Hi Thibault, it's a nice and simple (at least to understand :P) challenge but I suggest a couple of things to make it trickier:

    • Add some more test cases + random cases to avoid cheating
    • Add some long sequences so any o(n2) or worse solution (including mine) shall timeout
  • Loading more items...