Ad
  • Custom User Avatar

    It is not mentioned anywhere that inputs like [0] * n, n > 1 and [n] + [0] * m, n != 0, m > 1 should be interepreted as geometric sequences.

  • Custom User Avatar

    For invalid sequences either the output should be changed to None, or the function should throw an error. Returning a magic value which never occurs as "normal" function output because your input range is artificially limited is plain bad design.

  • Custom User Avatar

    In some cases, which do not correspond to either AP or GP, first element of sequence is expected instead of -1

    [198, 304, 540, 605, 961, 1165, 1325, 1596, 1635, 1900, 2123, 2318, 2503, 2699, 2814, 3051, 3201, 3427, 3768, 3821, 4157, 4366, 4411, 4621, 4996, 5107, 5343, 5552, 5765, 5963, 6105, 6350, 6525, 6720, 6841, 7105, 7366, 7422, 7618, 7808, 8032, 8209, 8541, 8746, 8827, 9123, 9283, 9423, 9772, 9953, 10041, 10207, 10587, 10766, 10935] 22
    
    -1 should equal 198
    
    [184, 364, 475, 747, 946, 1151, 1215, 1529, 1657, 1847, 2128, 2306, 2515, 2774, 2853, 3123, 3291, 3478, 3607, 3927, 4190, 4264, 4454, 4659, 4920, 5042, 5345, 5482, 5694, 5909, 6134, 6318, 6545, 6680] 92
    -1 should equal 184
    
  • Custom User Avatar

    I suggest to add more fixed and random test sequences containing zero(s) and negatives, e.g.:

    [0, 0, 0, 0, 1]       -->  -1  # none
    [-1, 0, 1, 2, 3]      -->   0  # AP
    [-1, 0, 0, 1, 2]      -->  -1  # none
    [0, 1, 0, 1, 0]       -->   0  # none
    [-1, 2, -4, 8, -16]   -->   1  # GP
    [-1, -2, -3, -4, -5]  -->   0  # AP
    

    etc.

  • Default User Avatar

    subtract the bigger number with the smaller one.

    bigger/smaller(a, b, c) or bigger/smaller(b, c) ?

  • Custom User Avatar

    Trivial arithmetic/conditions is neither novel nor interesting kata idea.