Ad
  • Custom User Avatar

    "the only thing that would actually meet that criteria is nested arrays." => Well, no. For instance, an array of string does the job just right.
    One could also choose to represent a whole 2D matrix with just one string (i.e https://www.codewars.com/kata/586214e1ef065414220000a8 and other string input katas do exactly that). I'm not sure what makes you think something would be wrong.

  • Custom User Avatar

    Yeah I saw that after I posted the issue, but decided to leave it up because although this problem elects to ignore that it's called "matrix" rotation. To my understanding in programming the term matrix is not applied to one dimensional arrays, and outside of things like C# multi-dimensional arrays the only thing that would actually meet that criteria is nested arrays.

  • Custom User Avatar

    No:

    Given a matrix represented as a list of string

  • Custom User Avatar

    This kata doesn't currently test for a scenario of nested arrays/lists. there should be tests akin to
    (
    [
    [1,2,3],
    [4,5,6].
    [7,8,9],
    ],
    [
    [7,4,1],
    [8,5,2],
    [9,6,3],
    ]
    ),

  • Default User Avatar
  • Custom User Avatar

    Exactly, that was my point. This kumite needs new test inputs

  • Custom User Avatar

    Correct, this will return False if it is odd and True if it is even. I've seen some more complex mathematical methods to detect if it's a power of two with just simple arithmetic but what would probably be easiest is to import Math and do return False if math.log(n, 2)%1 else True

  • Custom User Avatar

    I think this checks if a number is odd, not if it's a power of two. For example, 12 % 2 is equal to 0, yielding True but 12 is not a power of two.

  • Default User Avatar

    thank you ,this is good way