Java Backtracking with smart Pruning, 1ms beats 100%.
\nclass Solution {\n    Node [] nodes;\n    int size;\n    int result = 1_000_000;\n    \n    int currentSum;\n    \n    public int minimumIncompatibility(int[]
```\nclass Solution {\n    Node [] nodes;\n    int size;\n    int result = 1_000_000;\n    \n    int currentSum;\n    \n    public int minimumIncompatibility(int[] nums, int k) {\n        size = nums.length / k;\n        \n        nodes = new Node[k];\n        \n        for (int i = 0; i < k; ++i)\n            nodes[i] = new Node();\n        \n        Arrays.sort(nums);\n        currentSum = 0;\n        \n        solve (nums, 0);\n        \n        return result == 1_000_000 ? -1 : result;\n    }\n    \n    private void solve (int [] nums, int idx){\n        if (idx == nums.length){\n            result = currentSum;\n            return;\n        }\n        \n        int minSize = size;\n        \n        int prevMin, prevMax, diff;\n        \n        for (Node node : nodes){\n            if (node.size == minSize || node.visited[nums[idx]])\n                continue;\n            \n            minSize = node.size;\n            \n            prevMin = node.min;\n            prevMax = node.max;\n            \n            diff = prevMax - prevMin;\n            \n            node.min = Math.min(node.min, nums[idx]);\n            node.max = Math.max(node.max, nums[idx]);\n            node.size++;\n            node.visited[nums[idx]] = true;\n            \n            if (prevMin == 20){\n                currentSum += node.max - node.min;\n            }else {\n                currentSum += node.max - node.min - diff;\n            }\n            \n            if (currentSum < result)\n                solve (nums, idx + 1);\n            \n            if (prevMin == 20){\n                currentSum -= node.max - node.min;\n            }else {\n                currentSum -= node.max - node.min - diff;\n            }\n            \n            node.visited[nums[idx]] = false;\n            node.size--;\n            node.min = prevMin;\n            node.max = prevMax;\n        }\n    }\n}\nclass Node {\n    boolean [] visited;\n    int size;\n    int min;\n    int max;\n    \n    Node (){\n        visited = new boolean[17];\n        min = 20;\n        max = 0;\n        size = 0;\n    }\n}\n```
[]