Java 100% faster than all users
Intuition\nThe high score means the difference between the highest value and the lowest value. The low score means the difference between the two numbers which 
# Intuition\nThe high score means the difference between the highest value and the lowest value. The low score means the difference between the two numbers which are closest to each other. The question allows us to change two numbers. We will start by acknowledging that changing two numbers to be the same will result in low score of zero. Meaning we take any two numbers that we like and change them to be like a third number and the low score will be zero. Let\u2019s take an example, num = 1,2,3,4,5,6,7,8,9. The high score is 9 \u2013 1 = 8. The largest minus the smallest. We can change numbers 8,9 to be 7. Resulting in the new num =  1,2,3,4,5,6,7,7,7. This change improve the score two folds. First the low score is zero 7-7. Second the high score is now lower 7 -1 = 6. The idea is to use the ability to change numbers to first reduce the low score to zero, and then reduce the change between the highest and the lowest. In the above example, I have showed how we can reduce the high score by eliminating the two largest numbers. We can try to get the high value and the low value closer to each other in two other ways. We can change the two lowest to the same number as the third lowest. For example 3,3,3,4,5,6,7,8,9. The high score is now 9-3. One more way is to change on one each side. num = 2,2,3,4,5,6,7,8,8.\n\n# Approach\n\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nin place\n\n# Code\n```\nclass Solution {\n   \n        public static int minimizeSum(int[] nums) {\n                //find the lowest 3\n                int smallest = Integer.MAX_VALUE;\n                int secondSmallest = Integer.MAX_VALUE;\n                int thiredSmallest = Integer.MAX_VALUE;\n                for(int num : nums){\n                        if(num < smallest){\n                           thiredSmallest = secondSmallest;\n                           secondSmallest = smallest;\n                           smallest= num;\n                        }else if(num < secondSmallest){\n                            thiredSmallest = secondSmallest;\n                            secondSmallest = num;\n                        }else if(num < thiredSmallest){\n                            thiredSmallest = num;\n                        }\n                }\n            int largest= Integer.MIN_VALUE;\n            int secondLargest = Integer.MIN_VALUE;\n            int thiredLargest = Integer.MIN_VALUE;\n            for(int num : nums){\n                if(num >largest){\n                    thiredLargest = secondLargest;\n                    secondLargest = largest;\n                    largest= num;\n                }else if(num > secondLargest){\n                    thiredLargest = secondLargest;\n                    secondLargest = num;\n                }else if(num > thiredLargest){\n                    thiredLargest = num;\n                }\n            }\n            //System.out.println("smallest " + smallest + " second smallest " + secondSmallest + " Third smallest " + thiredSmallest);\n            //System.out.println("largest " + largest + " second largest " + secondLargest + " Third largest " + thiredLargest);\n            return Math.min(Math.min(thiredLargest - smallest, largest - thiredSmallest),secondLargest-secondSmallest);\n\n        }\n}\n```
['Java']