fork(12) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. int[] a = new int[] {4, 9, 1, 32, 13};
  9. Arrays.sort(a);
  10. int minDiff = a[1]-a[0];
  11. for (int i = 2 ; i != a.length ; i++) {
  12. minDiff = Math.min(minDiff, a[i]-a[i-1]);
  13. }
  14. System.out.println(minDiff);
  15. }
  16. }
Success #stdin #stdout 0.02s 245632KB
stdin
Standard input is empty
stdout
3