Find an array order, which satisfy Largest F=abs|S(0)-S(1)| + abs|S(1)-S(2)| + abs|S(2)+S(3)|;

public int[] fourInt(int a,int b,int c, int d){
   int[] res = new int[a,b,c,d];
   Arrays.sort(res);
  sawp(res,0,1);
  sawp(res,2,3);
  swap(res,0,3);
  return res;

}
public static void swap(int[] arr,int i, int j){
 int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}

results matching ""

    No results matching ""