import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone {
public static void main(String[] args) throws java.lang.Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
for (int i = 0; i < n; i++) {
arr[i] = Math.abs(arr[i + 0] - arr[i + 1]);
}
Arrays.sort(arr);
System.out.println(arr[arr.length - 1]);
}
}
I was trying to find the maximum difference between consecutive array elements, but while running my IDE is giving a runtime error.