6 kyu
Length of longest subsequence of same incrementing values
199Elyx0
Loading description...
Algorithms
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.
I'm just another dude who got confused by the title and the description. I think the kata description should have '-1 -2 -3' as an example, same for '1 1 1'
i got this failed test message: Up and down: expected 7 to equal 4 what does it mean?
CoffeeScript translation
Incrementation by negative values? A bit confusing, don't you think?
Why are you passing in a string? Everyone is doing .split(" "), and this breaks for empty string, which does not resolve to empty array.
Why not simply pass in an array?
The description (and title) says increment. I took this to mean increasing, but you have tests where the values decrease (decrementing instead). Could you clarify this for me, please?
Would really like to know the answer to this. I've submitted a valid solution, but I'm working on a more efficient version.
Yeah sorry, i could not find an easy title without making it sounds too complicated. I made it to be harder: adding positive numbers between each numbers in the chain was an already seen kata, it's better to think in terms of "same absolute step value between the members of the chain". So -1 -2 -3 would match.
So would
-1 -2 -1 0 2
match also? The "absolute step value" would be 1 in all cases.-1 -2 -1 0 2
will give3
matched by-2 -1 0
. You cannot be ascending and descending in the same chain for the step to work. So no, it won't match-1 -2 -1 0
as a valid chain of4
. I understand that it's tricky to explain. But a lot solved it like this so I thought it was clear. I hope this comment will help future readers.Okay, that's fine. The "absolute step value" threw me is all ;P
To be clearer, I would recommend you change all the mentions of "incremeneting" to be more explicit in what you mean. That should fix everything up for future coders.
I am completly agree with with issue. It needs to be fixed, it messes up the task solving and make solutions hacky
I'm passing all tests, but getting an error at the end:
Not sure why it is happening or how to fix it?
This comment has been hidden.
I removed the test that was blocking you. It was just calling longestSequenceIn() with no arguments supplied.
Thanks.
Please don't use
Test.expect
, useTest.assertEquals(«actual», «expected»[, msg])
instead, which automatically provides feedback.For example:
becomes
This makes it easier for the solver to figure out what went wrong, rather than only getting a pass/fail response.
Thanks, fixed !
Thanks!
You're missing simple cases for empty string or list containing only one element.
It's fixed ! Thanks