Ad
  • Custom User Avatar

    I submitted this solution by mistake (and it seems CodeWars doesn't allow deleting), it doesn't cover matrices that aren't squares, and it has a leftover console.log in the beginning... See my other solution for a correct version.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The test's description has a few English grammar mistakes.

  • Custom User Avatar

    add tests

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Thanks for responding anyways, first person to actually comment on anything I wrote / did on this site...

    Cheers.

    p.s.
    sorry, haven't seen The IT Crowd, heard it's good.

  • Custom User Avatar
    1. Let's agree to disagree, I think the "best practice" for this depends on the situation, and this situation implies mutation, unless otherwise stated.
    2. Obviously after solving it I understand what was meant, I'm just saying it might be confusing to some people and could use a bit of clarification. (sorry, didn't get the joke)
  • Custom User Avatar
    1. That's always the best practice to create a new object instead of modifying the existing one? When I see a method "add(vector)" on an object I think it's reasonable to assume it will modify that object.
    2. The description says "an equals method, to check that two vectors that have the same components are equal", by reading this I thought "that have the same components" means that a different amount of components should be considered an error, like in the rest of the methods.
  • Custom User Avatar

    Two requirments were unclear to me while solving this kata:

    1. Kata expects add & subtract results to be a NEW vector, not modify the existing one. (ConradLezo's comment helped me figure this out)
    2. equals shouldn't throw an error when lengths are different, only return false.
  • Custom User Avatar

    This is an interesting solution which would work for many cases, I like that the naming of the variables is very clear.
    However, I think it will fail for larger numbers (e.g. a number starting with "MMMMMMM").

    It's also inefficient in a few ways:

    1. It checks many possibilities that aren't in the input, for example if the number is just "I", it will go through everything before reaching it.
    2. Every roman = roman.Substring creates an entirely new string.
    3. Every call to RomanDecode.Solution() would create a new RomanNumerals array, even though it never changes.

    The RomanNumerals array is quite hard coded, I'd prefer that only the basic letter numbers will be hard coded ('M', 'C', 'D', etc.) and the possible combinations will be determined automatically.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Happened to me too.
    Took me a long time but I ended up realizing my code still wasn't efficient enough and fixed it.