Check for erroneous input index
if ( i < 0 or i > n - 1 ) : NEW_LINE INDENT printf ( " Invalid ▁ Input " ) NEW_LINE return NEW_LINE DEDENT diff , oldValue = 0 , 0 NEW_LINE oldValue = arr [ i ] NEW_LINE