Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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...
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.
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
Hi Tyguy7,
Yes, in the Discourse section, your solution seems incomplete, but in the Solutions page, it's complete and works fine...
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
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 :)).
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: ”.
Well, very straightforwardly, regular expressions and FSM are equivalent (http://lara.epfl.ch/w/equivalence_of_finite_state_machine_and_regular_expression_languages)
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.
Just a little misleading comment on your description:
should be false, according to the tests... :)
Nice kata, but maybe too close to the The Look and Say sequence...
Hi freizl, I'm sorry to signal you some little issues:
Once corrected, this kata makes a pretty bridge to Haskell :) (I suggest to mention that too!)
Good job! Now the kata makes sense :P
In the latter case, my solution breaks :(
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:
Loading more items...