• Custom User Avatar

    Why "1j" instead simply (!) "j" ??

  • Custom User Avatar

    I saw a random test like this:
    solution('apples, pears\ngrapes\nbananas !\nbananas', ['!']) should equal 'apples, pears\ngrapes\nbananas'

    but if the comment ends with \n ...

    "!\nbananas" should be an empty comment followed by a new line containing "bananas"

  • Custom User Avatar

    @steffan153

    Crystal translation does not appear to rstrip lines:

    solution("! oranges cherries\ncherries cherries cherries lemons\nwatermelons cherries lemons cherries pears , \nbananas . oranges ! pears pears\n^ bananas cherries lemons avocados #", ["'", "^", "#"])
    Expected: "! oranges cherries\ncherries cherries cherries lemons\nwatermelons cherries lemons cherries pears , \nbananas . oranges ! pears pears\n"
         got: nil
                                                                                                              ^^^^^^^^^
    

    reproducing: default code -> attempt -> ctrl+f " \n" (space followed by line terminator, without the quotes)

  • Custom User Avatar

    edit: nvm I have no idea what I'm talking about

  • Custom User Avatar

    Where do you read leading spaces must be removed?

    Any whitespace at the end of the line should also be stripped out.

    Use markdown formatting when posting code, otherwise spaces are collapsed and we can't see what you wanted to show:

    solution("'\n# watermelons ,  , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?", ["'", "@", ".", "-", "^"])
    Expected: "\n# watermelons ,  , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"
         got: "\n# watermelons ,  ,\noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"
    

    Which language are you talking about?

  • Custom User Avatar

    Test cases are inconsistent. The spec states to strip leading and trailing whitespace. And yet:

    solution("'\n# watermelons , , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?", ["'", "@", ".", "-", "^"])
    Expected: "\n# watermelons , , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"
    got: "\n# watermelons , ,\noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"

    The test case expects a string with trailing whitespace preserved, not stripped.

  • Custom User Avatar
  • Custom User Avatar

    comments are only for the rest of that line
    (better if you show the test case, or it will be assumed that you're not accurately describing it.)

  • Custom User Avatar
  • Custom User Avatar

    There are cases where "\n" is part of the comment and others where "\n" ends the comment ... Which one is right?

  • Custom User Avatar

    And hurry up if you will or your ships will sink before you even found them on the field.

  • Custom User Avatar

    Yes, and it's up to your code to figure out which one it is.

  • Custom User Avatar

    [1,1,1,1 ...] can be 1 battleship, 2 destroyers, 1 submarine + 1 cruizer, 2 submarines + 1 destroyer, 4 submarines...

  • Custom User Avatar

    Now, resolved.

  • Custom User Avatar

    No you don't. You copy and paste it into your test cases.

  • Loading more items...