Ad
  • Custom User Avatar

    I'm not sure if i'ts an anti-pattern or not, but I often flatten the list into one dimension and instead calculate a row length. In this case since the list lengths are constant, it is very easy to work with

  • Custom User Avatar

    I recommend changing the names of the arguments for the function or at least including a description of what each one is in the description. I printed each to see which was the element to count and which was the actual array which is an unnecessary step

  • Custom User Avatar

    Ah, similar but slightly different! I'll check it out, thanks :)

  • Custom User Avatar

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

  • Custom User Avatar

    Until the problem is fixed, I added a check for the basic tests. If the test is one of the basic tests, the correct solution is returned. If it is not one of the basic tests, the array with all 0's removed but NOT moved to the end of the array is returned. This solution is accepted despite the kata being broken.

  • Custom User Avatar

    This kata is broken and can only be solved by hardcoding the basic tests so that you know when the random tests begin. The random tests do not follow the rules of the kata. Instead they require that you return the array with all 0's removed (and NOT moved to the end of the array). Please fix this broken Kata. It is obviously broken and has been for quite a while. PLEASE FIX IT.

  • Custom User Avatar

    The method will still return false. The only way to reach the else clause is if both arrays are not nil.

  • Custom User Avatar

    Haha, doh! Once again I foolishly assumed that ruby didn't have a lcm method built-in!

  • Custom User Avatar

    Hahaaaa! This is great. Glad I learned about that!

  • Custom User Avatar

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

  • Custom User Avatar

    This solution makes a lot of sense, love that it splits get and set functions.

  • Custom User Avatar

    Enjoyed this one! Learned some valuable lessons about the way certain functions are called.

  • Custom User Avatar

    Wow, I hadn't even thought about all of these floating-point considerations! Really interesting, not sure I totally understand it yet, kind of having to step through it to understand completely what you're doing to account for floating point numbers