Ad
  • Custom User Avatar

    I disagree with both of you. As you can see 1675 people solved this kata. So it seems, that they understood the instructions.

    To solve a kata does not mean, to type the description of the kata in a computer language! It is thinking, trying, tranforming and testing. This kata is not so hard to understand.

  • Custom User Avatar

    I completely agree. Every time I thought I had solved the exercise it turned out there was another edge case I hadn't accounted for. On top of that the first initial test cases are all arrays of arrays so I thought I had solved this relatively quickly. It's frustrating when the difficulty in a problem is not the problem itself rather stumbling through the poor instructions.

  • Custom User Avatar

    Misleading instructions, in a couple of places:


    "You get an array of arrays."

    One of the test inputs is an empty array, [], another is the value null, and others are arrays that contain the value null in place of one or more arrays. This makes your very first statement incorrect; the first two of these specific examples are not arrays of arrays, and you could easily argue that the thirs example is not either. (Is a mixed array of arrays and numbers an "array of arrays"? I don't think so. Likewise, I do not think a mixed array of arrays and null values is an "array of arrays".) You could dramatically improve the instructions for this kata by modifying this first sentence: "The input to the function may be null, or may be an array. If the input is an array, it may be empty, or may contain null values and/or one or more arrays."


    "When an array in the array is null or empty, the method should return 0 too!"

    So "when an array...is null", the method should return 0.

    An array cannot be null. It can contain null (or even multiple nulls), but it cannot be null. I think many of the questions asked in this thread relate to this misleading clause. You could correct this by modifying the misleading clause:

    "When a component array in the array is empty, or when the component is the value null, the method should return 0 too!"