C# Short and clean code with explanation, easy to understand, beat 100%.
The key point is, when we build a new group, we always pick the smallest available number.\n\n\npublic class Solution\n{\n    private int min = int.MaxValue;\n 
The key point is, when we build a new group, we always pick the smallest available number.\n\n```\npublic class Solution\n{\n    private int min = int.MaxValue;\n    public int MinimumIncompatibility(int[] nums, int k)\n    {\n        Array.Sort(nums);\n        DFS(nums, nums.Length / k, 0, 0, 1, 0, 1);\n        return min == int.MaxValue ? -1 : min;\n    }\n\n    private void DFS(int[] nums, int groupSize, int start, int end, int curSize, int sum, int used)\n    {\n        if (curSize == groupSize) // Current group is full, try to build next group\n        {\n            sum += nums[end] - nums[start]; //Calculate new sum. nums are sorted, so end is max and start is min\n            if (sum >= min) return; //No need to continue\n            for (int newStart = start + 1; newStart < nums.Length; newStart++) //Find new start index for next group\n            {\n                int bit = 1 << newStart;\n                if ((used & bit) == bit) continue;\n                DFS(nums, groupSize, newStart, newStart, 1, sum, used | bit);\n                return; //Important! Always pick the smallest available number, no need to continue the loop.\n            }\n            min = sum; //Can\'t find new start, meaning all numbers are used already, set min.\n        }\n        else // Current group is not full\n        {\n            for (int newEnd = end + 1; newEnd < nums.Length; newEnd++) //Try to add more bigger number to the group\n            {\n                int bit = 1 << newEnd;\n                if ((used & bit) == bit || nums[newEnd] == nums[end]) continue;\n                DFS(nums, groupSize, start, newEnd, curSize + 1, sum, used | bit);\n            }\n        }\n    }\n}\n```
[]