Ad
  • Default User Avatar

    range(1,len(arr) is to loop through array, starting from index 1 to the last index of array. why do you do this? because you need to check the condition from second index which is index 1 for example: arr[1] - arr[1-1] > 1: imagine if you start from index 0 if it will be like this arr[0] - arr[0-1] or arr[0] - arr[-1]