有一个长为n的数组A,求满足0≤a≤b
import java.util.Arrays;
public class LongestDistance {
public int getDis(int[] A, int n) {
int max = 0;
int min = A[0];
for ( int i = 0 ; i < n ; i++){
if ( A[i] < min){
min = A[i];
}
if ( A[i] - min > max){
max = A[i] - min;
}
}
return max;
}
}