[JAVA] Generalized solution for K moves
\tpublic int minDifference(int[] nums) {\n        \n        int k = 3;\n        int n = nums.length;\n        \n        if(n < k + 2)\n            return 0;\n  
\tpublic int minDifference(int[] nums) {\n        \n        int k = 3;\n        int n = nums.length;\n        \n        if(n < k + 2)\n            return 0;\n        \n        Arrays.sort(nums);\n        \n        int min = Integer.MAX_VALUE;\n        \n        for(int i = 0; i <= k; i++){\n            min = Math.min(nums[n-1-i] - nums[k-i], min);\n        }\n        \n        return min;\n    }
['Sorting', 'Java']