6 kyu
Recursion: An introduction
469powderham
Loading description...
Recursion
Fundamentals
Tutorials
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.
Funny one! :) A little bit trickier than it seems.
A non-recursive solution can still pass the tests like this one
In the description, the third call should replace all values of
2
with3
The description needs better formatting as well
Thanks, that was fun recursion practice!
Tests do not adequately check for width = 0.
This is only covered by random tests which means that a solution can randomly pass and fail depending on whether or not it caters for width 0.
So some of the accepted solutions fail.
Was using this kata to introduce someone to recursion and there were some huge problems that came up.
Update; I totally missed that 0 width criteria was mentioned at the bottom. I definitely missed that reading the question the first time.
Hi there,
In your explaination the third call still has the value of '2' rather than '3'.
Cheers,
R
Approved
It is not explicitly stated how the function should behave when the width is 0, as can happen in the random tests. Either add clear specs for this case, or make sure that the random tests always have a width > 0.
p.s. nice kata :)
Agree. Description says
Return an array containing every stair you step on
. And since you always start on some step imo the result should at least have 1 element if you never move from that original step. Basically it is no different from something likestepDown(5,10)
where you also do not move (but for a different reason).Fixed
This comment has been hidden.
figured it out enough to get a solution so nevermind.
Hey, I think your description of the stair situation is very confusing. It looks like 0 is the top stair. so if, for example, you start in the 10th, going down, I thought the numbers will go up. So very confusing up-down top-bottom description. Had to look a few times and use the examples to understand what you want to get. Maybe you meant 100 - 0 top to bottom? you wrote 0 - 100 top to bottom. Might be that the confusion starts there.
I agree, the instructions are very confusing.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Initial tests need updating.
I am able to pass them with the same solution that passes the main tests so I am marking this as resolved.
Then in this case:
how is
9
in the answer? You can only step into lava from there too. Or if you end up in9
then why isn't it[5]
in the first case?You raise a good point, thank you! I have fixed the test case to require the first step and updated the description to indicate that the first step should always be returned.
I still have the same problem (your tests expect [] for stepDown(5, 7)).
Unsure how this reverted to the original, but I have reimplemented the change.
Thanks.
Nope, still the same problem.
It works now.
This comment has been hidden.
I have added these. Thanks for the feedback.