Ad
  • Default User Avatar

    I used "list" because I find that to be a bit less specific than "array" but I don't mind one way or another, I read them all in a language neutral manner.

  • Default User Avatar

    @natan: sorry I have just made the change of "array" to "collection" following Bandit254. Do you agree with that?
    Thanks for your proposal!

    PS:

    Obviously, having multiple versions by language is bad.

    I agree with that all the more that the difficulty could be different from one langauge to another one.

  • Default User Avatar

    I made an attempt at cutting things down a bit.
    I'd ideally want complete neutrality but I understand that not all languages express input/output well in their types and that not everyone is so quick to look at the sample tests. Still, I think this is a fair bit less redundant without losing much. Obviously, having multiple versions by language is bad.


    Can you translate this drawing into an algorithm?

    You will be given two dimensions

    1. a positive integer length
    2. a positive integer width

    You will return a list or a string depending on the language.

    When the initial parameters are so that length == width, the solution [length] would be the most obvious but not in the spirit of this kata so, in that case, return None/Nothing/nil/null/{}/Array() or in the case of C, its sz component should equal 0.

      sqInRect(5, 3) should return [3, 2, 1, 1]
      sqInRect(3, 5) should return [3, 2, 1, 1]
      sqInRect(3, 3) should return None/Nothing/nil/null
    
      Shell bash, PowerShell, Pascal, Fortran return a string:
      sqInRect(5, 3) should return "3 2 1 1"
      sqInRect(3, 5) should return "3 2 1 1"
      sqInRect(3, 3) should return "nil"
    
      C returns a structure, your result and the reference test solution are compared by strings.
    
      You can see more examples in **"SAMPLE TESTS"**
    

    length == width as a starting case would be an entirely different problem and the drawing is planned to be interpreted with length != width. (See kata, Square into Squares. Protect trees! http://www.codewars.com/kata/54eb33e5bc1a25440d000891 for this problem).

  • Default User Avatar

    @Bandit254: I modified the tests so there are no more a difference between the "Solution" and the tests in C#.

  • Default User Avatar

    It seems that more than 18,000 people understood that "array" here was a generic term. Moreover the examples show that it can refer to different structures depending on the language.
    What do you propose to remove that "cruft"?

  • Default User Avatar

    The kata description uses the word "array", but it isn't referring to any particular data structure in any particular language so you shouldn't interpret it as such.
    I'd want to see the language specific cruft cleared out of the description because it's drowning out the description itself.

  • Custom User Avatar

    Example tests are OK, and task is not about creating an exact reverse of input. Please read task description carefully, especially examples.

    Resolving as not a kata issue.