6 kyu

Same Array?

484 of 1,025osofem
Description
Loading description...
Fundamentals
Arrays
  • Please sign in or sign up to leave a comment.
  • Just4FunCoder Avatar

    This comment has been hidden.

  • Just4FunCoder Avatar

    This comment has been hidden.

  • Just4FunCoder Avatar

    Python, JavaScript, PHP:

    Wrong array dimension in the describe block message, 'Simple 3x3 arrays' should be 'Simple 3x2 arrays'

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • FArekkusu Avatar

    There should be tests with outer arrays having same values spread across different sub-arrays.

  • bestwebua Avatar

    Very nice kata! Cheers! :)

  • user5036852 Avatar

    Very nice kata! Thanks!

  • inigo_montoya Avatar

    So I've got a question here about the test cases...I re-read the kata and my initial solution was to sum the different arrays and if they are == then it's True. Everything passed in the tests but am wondering if this test should be included.

    Test.assert_equals(same([[5,5],[0,2]], [[7,3],[1,1]]), False, "Values that sum the same but are different")

  • teochewthunder Avatar

    This comment has been hidden.

  • GiacomoSorbi Avatar

    Pardon me if I may insist, but if you might consider my translation, as a side effect I would also be able to fix the JS version - just in case you don't have enough time or focus right now ^^'.

  • asafusan Avatar

    In the random tests I get "Expected: undefined, instead got: false" while when testing the same test arguments and the same code in JSbin the result is "undefined", in addition all my 'return' statements return undefined.

    Might be related to @natesanity post about the "and" in the random test case.

  • natesanity Avatar

    AND instead of ',' in random test case? Am I doing something wrong or is the test case wrong?

  • GiacomoSorbi Avatar

    Translated it into both Ruby and Python, if you want to approve them.

    Also, the JS test cases seem like they may need some rework: let me know if a hand is appreciated there :)

  • Blauelf Avatar

    The test cases are lacking a test for the first line [[2,5], [3,6]] is NOT the same as [[2,3], [5,6]]. Some solutions flatten the array for convenience and would not pass this test, yet they do while violating the very first of the numbered rules.

    Another thing that is not tested are duplicates. Different solutions have different opinions on whether same([[1,2],[1,2],[3,4]],[[1,2],[3,4],[3,4]]) should evaluate to true or not.

  • YiyangLi Avatar

    Please double check the random tests. I print out the input arguments, it doesn't match those arrays you mentioned after the 'value not expected'.

    [ [ 14, 6 ], [ 6, 72 ], [ 78, 63 ], [ 32, 77 ], [ 39, 30 ], [ 47, 47 ], [ 55, 45 ], [ 34, 95 ], [ 2, 52 ], [ 50, 25 ], [ 47, 95 ], [ 1, 85 ], [ 39, 22 ], [ 77, 30 ], [ 31, 95 ], [ 9, 14 ], [ 32, 79 ], [ 6, 78 ], [ 62, 3 ], [ 30, 76 ], [ 3, 13 ], [ 87, 16 ], [ 30, 89 ], [ 10, 20 ], [ 92, 7 ], [ 56, 37 ], [ 35, 37 ], [ 29, 66 ], [ 78, 96 ], [ 60, 24 ], [ 50, 55 ], [ 37, 7 ], [ 47, 69 ], [ 28, 98 ], [ 44, 69 ], [ 55, 65 ], [ 15, 95 ], [ 47, 73 ], [ 17, 96 ], [ 21, 7 ], [ 97, 2 ], [ 79, 96 ], [ 46, 52 ], [ 78, 70 ], [ 42, 79 ], [ 71, 92 ], [ 87, 38 ], [ 8, 79 ], [ 64, 78 ], [ 73, 68 ], [ 9, 47 ], [ 25, 16 ], [ 87, 21 ], [ 81, 92 ], [ 27, 49 ], [ 99, 70 ], [ 50, 60 ], [ 31, 17 ], [ 44, 19 ], [ 94, 26 ], [ 99, 1 ], [ 56, 75 ], [ 28, 77 ], [ 10, 21 ] ] ======= [ [ 21, 10 ], [ 77, 28 ], [ 75, 56 ], [ 1, 99 ], [ 26, 94 ], [ 19, 44 ], [ 17, 31 ], [ 60, 50 ], [ 70, 99 ], [ 49, 27 ], [ 92, 81 ], [ 21, 87 ], [ 16, 25 ], [ 47, 9 ], [ 68, 73 ], [ 78, 64 ], [ 79, 8 ], [ 38, 87 ], [ 92, 71 ], [ 79, 42 ], [ 70, 78 ], [ 52, 46 ], [ 96, 79 ], [ 2, 97 ], [ 7, 21 ], [ 96, 17 ], [ 73, 47 ], [ 95, 15 ], [ 65, 55 ], [ 69, 44 ], [ 98, 28 ], [ 69, 47 ], [ 7, 37 ], [ 55, 50 ], [ 24, 60 ], [ 96, 78 ], [ 66, 29 ], [ 37, 35 ], [ 37, 56 ], [ 7, 92 ], [ 20, 10 ], [ 89, 30 ], [ 16, 87 ], [ 13, 3 ], [ 76, 30 ], [ 3, 62 ], [ 78, 6 ], [ 79, 32 ], [ 14, 9 ], [ 95, 31 ], [ 30, 77 ], [ 22, 39 ], [ 85, 1 ], [ 95, 47 ], [ 25, 50 ], [ 52, 2 ], [ 95, 34 ], [ 45, 55 ], [ 47, 47 ], [ 30, 39 ], [ 77, 32 ], [ 63, 78 ], [ 72, 6 ], [ 6, 14 ] ] Value not what is expected for [[14,6],[6,72],[78,63],[32,77],[39,30],[47,47],[55,45],[34,95],[2,52],[50,25],[47,95],[1,85],[39,22],[77,30],[31,95],[9,14],[32,79],[6,78],[62,3],[30,76],[3,13],[87,16],[30,89],[10,20],[92,7],[56,37],[35,37],[29,66],[78,96],[60,24],[50,55],[37,7],[47,69],[28,98],[44,69],[55,65],[15,95],[47,73],[17,96],[21,7],[97,2],[79,96],[46,52],[78,70],[42,79],[71,92],[87,38],[8,79],[64,78],[73,68],[9,47],[25,16],[87,21],[81,92],[27,49],[99,70],[50,60],[31,17],[44,19],[94,26],[99,1],[56,75],[28,77],[10,21]] and [[21,10],[77,28],[75,56],[1,99],[26,94],[19,44],[17,31],[60,50],[70,99],[49,27],[92,81],[21,87],[16,25],[47,47]] - Expected: false, instead got: true