Beta
Accumulated skiing altitude
57 of 80barakplasma
Loading description...
Arrays
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.
Python translation
In Rust, in some random tests the provided ids in the
lifts
list are not unique and the test can only be passed if you use the id's first appearance. This defies the concept of an id.Furthermore sometimes ids are passed in the
rides
list which do not occur in thelifts
List.It either should be specified in the description what happens in these cases or the tests should be corrected.
You're right, I re-published with better tests.
Details
I was relying on quickcheck before, but it's too random.
I removed quickcheck, and replaced the random tests with one where the id's are guaranteed to be unique.
I also made sure the rides id list is limited to the ids in the lifts id range.
random_quick_check [quickcheck] TEST FAILED. Arguments: ([Lift { start: -94, end: 92, id: 52 }, Lift { start: 30, end: 78, id: 52 }], [52])
Is it correct to have different lifts with the same id? I think is a bug
Fixed with new tests not based on quickcheck
You don't say how the sum of descents is actually supposed to be caluculated.
Also, no random tests.
There is actually a "random" test ( now? ).
But please just wrap that in a
for
loop and run it a hundred times. Also, the random test doesn't seem to be random - look at the top Clever solution [ Avanta's, that is :]. ( The expected value should be random, not just the input! )added the following example calculation:
Example
if a skiier took lift #1 which starts at 100 meters, and lifts them to 1000 meters, they would have an accumulated skiing altitude of 900 meters at the point (1000 - 100). If that same skiier rode down the mountain and took lift #2 which starts at 500 meters and lifts them to 1500 meters, their new accummulated altitude would be 1900 meters ((1000 - 100) + (1500 - 500) = 1900 meters ).
@JohanWiltink I added 106 more random tests, with more variation in them.