6 kyu

Transpose of a Matrix

612 of 869debri
Description
Loading description...
Linear Algebra
Matrix
Data Structures
Mathematics
Arrays
Fundamentals
  • Please sign in or sign up to leave a comment.
  • Voile Avatar

    Re-raising the issue: this kata is a duplicate of https://www.codewars.com/kata/52fba2a9adcd10b34300094c

  • Madjosz Avatar

    JS: missing sample tests

  • ejini战神 Avatar
    • Python new test framework should be used (Refer this & this for more detail)

    • Ruby 3.0 should be enabled (Refer this & this for more detail)

  • FArekkusu Avatar

    It is not explained how to handle empty arrays, and transposing a Nx0 matrix into 1x0 makes no sense.

  • hobovsky Avatar

    Duplicate of Matrix Transpose.

  • TimSonrisa Avatar

    The test cases in Python translation for different empty matrices are completely unneccessary, there is no point in it. Even more, they don't have any meaning from computing or the algebraic perspective and confuse the real purpose of transpose operation.

  • twypsy Avatar

    Kudos for the gif, although transposing and array with empty subarrays seems strange.

  • chessmonger2112 Avatar

    Should be clear how to handle empty arrays, and arrays that contain empty arrays.

  • ecolban Avatar

    As already pointed out, [[]] is a matrix with one row and zero columns, which is not really a matrix.

  • winterblack Avatar

    Ruby has a transpose function. This code

    class Array end

    passes the four self tests and the first seven kata tests.

    It may be possible, but I wasn't able to overwrite ruby's native transpose method.

  • Unnamed Avatar

    [[]] is a strange test. The "matrix" has 1 row and 0 columns, so the result should have 0 rows and 1 column which is not expressible with a list of lists and thus not reversible. I don't know why this test exists at all.

  • Nuno Avatar

    Basic tests 1 and 9 are contradictory, if you pass one you can´t pass the other. Test 1 says "[[]] should equal []" and test 9 says "[] should equal [[]]". Fix it please

  • DivyanshBatham Avatar

    Some Examples Test Cases(in JS) will be an added star to the excellence of this kata ;)

  • jake9066 Avatar

    There are some grammatical errors in the description, but this is pretty nitpicky since I don't believe it is enough to hinder comprehension

  • joakim Avatar

    Some more destrcitption required on how to handle empty arrays.

  • kungmarten Avatar

    Quite hard to solve since the test for transposed([]) should return different lists ([[]] and [])

  • Unnamed Avatar

    Python tests contain both [] and [[]]. That's weird...

  • GiacomoSorbi Avatar

    Ruby and Python translations submitted: if you wish to approve them, then post a reply to this comment, so that I can then edit the description a bit to better fit these two languages.

    As usual, feel free to ask for more standard/random tests on JS too if you like my work :)