Ad
  • Custom User Avatar

    edge cases needed:

    test.assert_equals(find_arithmetic_sequence([2,3,1,4]),[1,2,3])
    test.assert_equals(find_arithmetic_sequence([816, 428, 446, 459, 471, 486, 496, 511, 527, 537, 551, 564, 819, 594, 607, 616, 631, 646, 662, 674, 687, 698, 716, 724, 740, 755, 813, 778, 794, 808, 821, 837]),[446, 631, 816])
    
    test.assert_equals(find_arithmetic_sequence([265, 279, 295, 811, 321, 330, 346, 808, 371, 388, 398, 414, 425, 443, 814]), [808, 811, 814])
    test.assert_equals(find_arithmetic_sequence([893, 368, 382, 890, 408, 896, 434, 449], [890, 893, 896])
    

    note: I didn't "explore" the solution suggested by Johan, so you'll have to dig on this side too

  • Custom User Avatar

    This solution has a bug. But the fixed test cases don't catch it, and the randoms only catch it occasionally.

    A fixed test should be added that catches it. Use a failing random test for that. That's another think random tests are good for: finding edge cases, not necessarily in your own solution(s) but in everybody's. ( It would have been nice to get this heads up from that author, but maybe he totally missed the bug. )

  • Custom User Avatar

    Hi,

    • python: make the solution setup runnable, plz

    • a lot of missing edge cases in the fixed tests. I've rewriten my algo 4 times, each one passing all the current fixed tests. Meaning that, as said before, there aren't enough fixed tests, but that means the description either doesn't give enough info (not the case) too, or doesn't give them in a clear enough way (the info is too far diluted, here ).

      for example:   [360, 825, 391, 405, 414, 428, 442, 454, 828, 486, 822]
                     [414, 428, 442] should equal [822, 825, 828]
      
    • reading it closer, either the description or the reference solution is actually wrong: such that the first member of the sequence will have the lowest indexed first member from the array, according to the case above (...or I just don't get that sentence... :/ )