Ad
  • Default User Avatar

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

  • 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).

  • Custom User Avatar

    @g964 - that makes more sense now, thanks!

    @g964 and @natan - if you want the description to reference a generic data structure, then wouldn't the term "collection" be a better choice? As in, "return a collection of the squares that can be made from the rectangle." Because the description currently reads "return an array or string", which causes the reader to focus on those two specific data types.

  • 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

    It is difficult to determine what data type you are supposed to return (list or array) because the instructions and test code say array, but the submission window has the return type as list. I would recommend changing the submission window to have the return type as array so that it's consistent with the rest of the intsructions/test code. Otherwise, I enjoyed this Kata

  • Custom User Avatar

    Ok, I see how I misinterpreted the prompt. I would recommend including a statement similar to "Note: Reversing the order of the bytes is not the same as simply reversing the given input array" to avoid confusion.

  • Custom User Avatar

    there ARE random tests already...

    edit: I actually completely rewrote the tests anyway...

  • Custom User Avatar

    done

  • Custom User Avatar

    No, it will when Node version >= 11

  • 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.

  • Default User Avatar

    Actual and expected are flipped for some tests python

  • Loading more items...