Java 100% faster Time Complexity O(n log n) Space Complexity O(1)
Intuition\n Describe your first thoughts on how to solve this problem. \nsort and find the minimum difference of two consecutive number.\n\n# Approach\n Describ
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nsort and find the minimum difference of two consecutive number.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nJust Sort the array and then find the minimum difference between two consecutive number of an array.\n\n# Complexity\n- Time complexity: O(n log n) because of sorting of the array.\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int findValueOfPartition(int[] nums) {\n        Arrays.sort(nums);\n        int m=Integer.MAX_VALUE;\n        for(int i=1;i<nums.length;i++)\n            m=Math.min(m,Math.abs(nums[i]-nums[i-1]));\n        return m;\n    }\n}\nfeel free to ask your doubt happy to help....\nIf it help then plz upvote it.....Thanks!!!!\n```
['Math', 'Greedy', 'Sliding Window', 'Sorting', 'Java']