Ad
  • Custom User Avatar

    ah, thanks for clarifying. I was sure that's how I read it but I've been calculating the difference between the first and last element ([2,34,2] incorrectly yields 0) in a 3 amigo array (which can work with the array sorted).

  • Custom User Avatar

    Hi,

    From the example in the description, shouldn't the first 3 Amigos be [2, 34, 2], range 0 and even parity.

    Here's what is shown as the result at the moment:

    ex1
    Input = [1, 2, 34, 2, 1, 5, 3, 5, 7, 234, 2, 1]
    Result = [5,3,5]
    
  • Custom User Avatar

    this was a comment on the solution, so didn't think it would be accessible to those that haven't solved the kata yet. anyway, I shall mark any comment with code as spoiler, thanks for the reminder! :)

  • Custom User Avatar

    This was the missing piece 'all methods in ruby that accept a block will also accept a block parameter as the last argument'. Thanks!

  • Custom User Avatar

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

  • Custom User Avatar

    sure, I can add a bit more clarity to description as suggested.

  • Custom User Avatar

    Makes sense! I have fixed that now. Also, thanks for that detailed explanation, very helpful

  • Custom User Avatar

    hi,

    thanks for pointing that out, but how is changing the input possible like this, and how can I fix that ..

  • Custom User Avatar

    I hadn't changed anything, and tried it again just now with positive result. Odd, have to find out what's going on. I am open to any insight.

    Test.assertDeepEquals(badApples([ [ 1, 0 ], [ 0, 5 ], [ 0, 7 ] ]), [ [ 1, 5] ]);
    
    Time: 453ms Passed: 1 Failed: 0
    Test Results:
    Test Passed: Value deep equals [[1, 5]]
    You have passed all of the tests! :)
    
    
    
  • Custom User Avatar

    I ran the test and it passed. could you run the test on its own under sample tests?

    here are the two tests that were reported as fails:

    Test.assertDeepEquals(badApples([ [ 5, 5 ],[ 0, 6 ],[ 6, 0 ],[ 4, 2 ],[ 2, 7 ],[ 2, 4 ],[ 6, 7 ],[ 5, 6 ],[ 4, 2 ] ]), [ [ 5, 5 ],[ 6, 6 ],[ 4, 2 ],[ 2, 7 ],[ 2, 4 ],[ 6, 7 ],[ 5, 6 ],[ 4, 2 ] ])
    Test.assertDeepEquals(badApples([ [ 1, 0 ], [ 0, 5 ], [ 0, 7 ] ]), [ [ 1, 5] ]);
    
    Time: 343ms Passed: 2 Failed: 0
    Test Results:
    Test Passed: Value deep equals [[5, 5], [6, 6], [4, 2], [2, 7], [2, 4], [6, 7], [5, 6], [4, 2]]
    Test Passed: Value deep equals [[1, 5]]
    
    
  • Custom User Avatar

    hmm, odd, I ran the test and it passed. could you run the test on its own under sample tests?

    here are the two tests that were reported as fails:

    
    Test.assertDeepEquals(badApples([ [ 5, 5 ],[ 0, 6 ],[ 6, 0 ],[ 4, 2 ],[ 2, 7 ],[ 2, 4 ],[ 6, 7 ],[ 5, 6 ],[ 4, 2 ] ]), [ [ 5, 5 ],[ 6, 6 ],[ 4, 2 ],[ 2, 7 ],[ 2, 4 ],[ 6, 7 ],[ 5, 6 ],[ 4, 2 ] ])
    Test.assertDeepEquals(badApples([ [ 1, 0 ], [ 0, 5 ], [ 0, 7 ] ]), [ [ 1, 5] ]);
    
    Time: 343ms Passed: 2 Failed: 0
    Test Results:
    Test Passed: Value deep equals [[5, 5], [6, 6], [4, 2], [2, 7], [2, 4], [6, 7], [5, 6], [4, 2]]
    Test Passed: Value deep equals [[1, 5]]
    
    
  • Custom User Avatar

    thanks for spotting that, checking now.

  • Custom User Avatar

    hey thanks for spotting that, checking now.

  • Custom User Avatar

    Hi,

    Sure,the output for [ [ 1, 0 ], [ 0, 5 ], [ 0, 7 ] ] should be [ [ 1, 5] ], and you are correct in your explanation. We sort out bad packages from the top of the fruit box, so [ 1, 0 ] and [ 0, 5 ]gets dealt with first. [0,7] remains and will have to be discarded (as per condition) since the package can't be populated with a spare.

  • Custom User Avatar

    Cool, thanks for the link.

  • Loading more items...