Ad
  • Custom User Avatar

    wow! i've thought of this (recursive) but have no idea how to pull this out :D

  • Custom User Avatar

    ncarenza is correct. [[]].length = 1; [].length = 0 so [[]] is not an nxn matrix.

  • Custom User Avatar

    1X1 = [[1]], [1]

    0X0 = [[]]

    Since it's a square matix you could get the size with the array inside. Good look!

  • Custom User Avatar

    I agree and understand the intent it's just that some katas', as you mentioned, have a vague description and as a non-native english speaker, I sometimes guess what they want me to do. But I think it's still a nice feature to have, as a newbie programmer, I still have a lot to understand especially when some of the kata's test specs are very tricky that I haven't even experienced and will not really understand what I did wrong.

  • Custom User Avatar

    This is an intended feature. Knowing the tests would make you directly aware of some of the complexities you wouldn't have thought off otherwise.

    I can undertand your request, but I think the idea behind code katas and codewars is not to provide software specs so you comply to them, but to force you to write rather generic code that would hold against sneaky edge cases you might not have thought of.

    Of course the success of this approach is debatable, as I see some katas where people do just that: write something that complies to the test and that would be a dreadful piece of code to use in enterprise software.

    Maybe the issue lies more with the kata's description than with the tests. I think it's a judgment call, and it'd be hard for them to make it work both ways. It's just too bad that some katas try to have you guess while others try to enforce specs that sometime seem silly.

  • Custom User Avatar

    Knowing what the specs of the test is. Sometimes when I try to submit my solution, it's failing on some tests and I don't know what should I change in my code.

  • Default User Avatar

    For every random-reliant test case, there should be a functoin that measures the distribution of randomness. E.g. right now I'm working on ensuring a sample of string permutations is random for a kata.

  • Custom User Avatar

    nice use of the ~ operator

  • Custom User Avatar

    An API to include my progress as a part of my online resume.

  • Custom User Avatar

    i feel like that is a 1x0. the length of the first dimention is 1. wouldn't a 0x0 be modeled as []?

  • Custom User Avatar

    Yes, you're right, that's a test case, it's nxn, both empty.

  • Custom User Avatar

    I have a feeling one of your test cases is snail([[]]) instead of snail([]). Is that still considered an nxn?