6 kyu
Every nth array element. (Advanced)
41Insti
Loading description...
Arrays
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
More fixed tests for negative
start_index
&&interval
should be addedRuby 3.0 should be enabled (Refer this & this for more detail)
The test failure messages should show the inputs that failed.
Something is wrong in test cases in negative interval section (ruby). eg: [0, 1, 2, 3, 4].every(-1, 0) Expected: [0], instead got: [0, 4, 3, 2, 1]. Can not pass it with good solution.
This is similar to the example case:
The answer you are getting is what happens if you let the array index become negative. You should ensure that you stop when you get to zero, and don't go negative.
This does not appear to currently be explicitly documented though. I will clarify the description.
ah ok, I see. Thanks
I've updated the description, hopefuly that is helpful. I'm not sure about the wording, suggestions for improvement are encouraged.
The element at
start_index
not being expected in the result wheninterval
is negative looks strange. If that's what you intended to do then at least rename the argument.Good spot, it should be, I'll ammend the tests.
Sorry, I think test cases are not clear enough and more explanation/examples are needed.
Which cases are unclear?
This comment has been hidden.
Thanks,
I've written up the details for all the 'advanced' features with some examples.
Let me know if there's still anything that could be added to make things clearer.
Sounds better. Good job !