You are viewing a single comment's thread. Return to all comments →
Thanks your guidence lead to Better solution !!
public class Solution {
// Complete the minimumAbsoluteDifference function below. static int minimumAbsoluteDifference(int[] arr) { Arrays.sort(arr); int min = Math.abs(arr[0] - arr [1]); for(int i = 1 ; i < arr.length-1 ; i++){ if(Math.abs(arr[i] - arr[i+1]) < min) min = Math.abs(arr[i] - arr[i+1]); } return min; }
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Absolute Difference in an Array
You are viewing a single comment's thread. Return to all comments →
Thanks your guidence lead to Better solution !!
public class Solution {