6 kyu

2D array inner join

77 of 178mik
Description
Loading description...
Fundamentals
Matrix
Algorithms
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    Nice kata, well done.

  • Len512 Avatar

    Javascript:

    Max Buffer Size Reached (1.5 MiB), even though I'm logging nothing.

    Solution fails even though I pass all the tests.

  • Blind4Basics Avatar

    python at least:

    • sample tests should contain at least one test with indA and indB different from zero and another with indA != indB

    • The random tests are sometimes generating cases where different matching keys are interleaving with each others, while nothing is told about how to handle that in the description:

                           **                                            ++                   **
      [[8, 'm', None, 5], [False, 1, None, 0], ['z', None, 'k', False], [9, 'b', None, 'i'], [False, 'm', False, 6]]
      arrB = [['z', None, 'e', 'm'], [None, False, 'z', 8], ['p', False, 'y', 't'], [False, 'l', 7, 'f'], [False, 9, 'm', 'j']]
      indA,indB = 0 1
      
      [[False, 1, None, 0, None, False, 'z', 8], [False, 1, None, 0, 'p', False, 'y', 't'], [False, 'm', False, 6, None, False, 'z', 8], [False, 'm', False, 6, 'p', False, 'y', 't'], [9, 'b', None, 'i', False, 9, 'm', 'j']] should equal
      [[False, 1, None, 0, None, False, 'z', 8], [False, 1, None, 0, 'p', False, 'y', 't'], [9, 'b', None, 'i', False, 9, 'm', 'j'], [False, 'm', False, 6, None, False, 'z', 8], [False, 'm', False, 6, 'p', False, 'y', 't']]
      

    Either to add the requirement to keep the original order, based on arrA (meaning O(n²) approach is somewhat a requirement... :/ ), or sort the random arrays before sending them to the user (according to indA and indB ; sounds like the worst option here, maybe), or modify the way the assertions are done so that actual and expected values are sorted before comparison?

    edit: for instance: this solution passes the random tests only from time to time because of the unspecification above (btw, could be good to increase the number of random tests to 100)

  • JohanWiltink Avatar

    ( JS )

    Changed Test to chai because failure messages were showing [Object].

  • FArekkusu Avatar

    Assume that each 2D array contains only primitive data types (number, string, boolean, null and undefined)

    This should be reflected in the random tests as well.

  • Voile Avatar

    At least in JS, the test message for the two tests with NaN keys are incorrectly marked as Non matching rows (null).

  • FArekkusu Avatar

    Python 3 should be made available.

  • FArekkusu Avatar

    The description should be made language-independent.

  • FArekkusu Avatar
    a = [[1, 1], [2, 2]]
    b = [[1, 10], [3, 30]]
    index_1 = 2
    index_2 = 2
    

    You can't specify non-existent columns for JOIN in SQL, and the expected behavior is not explained anywhere.

  • FArekkusu Avatar

    No sample tests (in Python at least).

  • JohanWiltink Avatar

    Haskell translation

    ( updated for fork for description update )

  • JohanWiltink Avatar

    Needs random tests

  • ZozoFouchtra Avatar

    This comment has been hidden.