7 kyu
Maximum different differences
107Donvito-911
Loading description...
Mathematics
Puzzles
Performance
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.
This comment has been hidden.
This comment has been hidden.
hi,
not enough sample tests. you should give some relevant intermediates, and a big value that is leading to precision troubles.
Cheers
Already added some test cases in sample also covering those precision troubles.
Tests should be improved to eliminate some incorrect solutions. The following fork contains improved tests. I also recommend to increase the upper bound up to
2 ** 200
.Wow, thank you!, already fixed! I tried to increase the upper bound but I had some problems with Overflow error.
You don't need to use
random.sample
for big ranges. It is enough to userandom.randint
(orrandom.randrange
) to generate test cases. The probability of getting the same numbers is small for big ranges.Yes!!, Added some more test cases and the incorrect solution is also not workin with a_n > 2^60. Thank you!
My solution was not performance type solution, but still passed.
What is the expected time complexity?
This comment has been hidden.
From your examples I could assume that the minimum value allowed in the array was 1, but you don't explicitly state so in the description.
Well, it is implicitly defined when it says "a" is a strictly increasing array of integers. If there is a 0 in "d", that violates the "strictly increasing" part of "a".
I think the reader should figure it out, but if you still think I should be clearer and put it explicitly, please open again the issue
Sorry, I meant that the minimum value of array a is 1. I agree with you that it is clear for array d.
Oh, you are right. Thank you !