7 kyu

Maximum different differences

Description
Loading description...
Mathematics
Puzzles
Performance
  • Please sign in or sign up to leave a comment.
  • DavidJES Avatar

    This comment has been hidden.

  • Blind4Basics Avatar

    hi,

    not enough sample tests. you should give some relevant intermediates, and a big value that is leading to precision troubles.

    Cheers

  • monadius Avatar

    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.

    • Donvito-911 Avatar

      Wow, thank you!, already fixed! I tried to increase the upper bound but I had some problems with Overflow error.

      Issue marked resolved by Donvito-911 2 years ago
    • monadius Avatar

      You don't need to use random.sample for big ranges. It is enough to use random.randint (or random.randrange) to generate test cases. The probability of getting the same numbers is small for big ranges.

    • Donvito-911 Avatar

      Yes!!, Added some more test cases and the incorrect solution is also not workin with a_n > 2^60. Thank you!

  • LanXnHn Avatar

    My solution was not performance type solution, but still passed.

    What is the expected time complexity?

  • MattSchmitz Avatar

    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.

    • Donvito-911 Avatar

      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

      Issue marked resolved by Donvito-911 2 years ago
    • MattSchmitz Avatar

      Sorry, I meant that the minimum value of array a is 1. I agree with you that it is clear for array d.

    • Donvito-911 Avatar

      Oh, you are right. Thank you !