For this Question: There are N places, numbered 1,2,…,N. For each i (1≤i≤N), the height of place i is hi.
There is a man who is initially on place 1. He will repeat the following action some number of times to reach place N:
If the man is currently at place i, he will go to place i+1 or place i+2 i.e. maximum 2 jumps allowed. Here, a cost of |hi−hj| is incurred, where j is the place where the man goes. Find the minimum possible total cost incurred before the man reaches place N.First line contains N size of array, second line contains elements of array.

Constraints
2 ≤ N ≤ 10^5
1 ≤ hi ≤ 10^4Print the minimum possible total cost incurred.Sample Input:
4
10 30 40 20

Sample Output: 
30

Explanation:
Testcase 1: If we follow the path 1→ 2→ 4, the total cost incurred would be |10−30|+|30−20|=30., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static long minCostIncurred(int arr[],int n){
		long costTillNow[]=new long[n];
		costTillNow[0]=0;
		costTillNow[1]=Math.abs(arr[1]-arr[0]);
		for(int i=2;i<n;i++){
			costTillNow[i]=Math.min(costTillNow[i-1]+(long)Math.abs(arr[i]-arr[i-1]),costTillNow[i-2]+(long)Math.abs(arr[i]-arr[i-2]));
		}
		return costTillNow[n-1];
	}
	public static void main (String[] args) throws IOException {
		BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String str[]=br.readLine().trim().split(" ");
		int arr[]=new int[n];
		for(int i=0;i<n;i++){
			arr[i]=Integer.parseInt(str[i]);
		}
		System.out.println(minCostIncurred(arr,n));

	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?