DFS and BackTracking gives double 100%.  idea is easy to understand.
Intuition\nBacktracking and DFS\n\n# Approach\n1. create a list with K Length( like K boxess)\n2. create an array of length 17 to records value from 1-16 \n\nba
# Intuition\nBacktracking and DFS\n\n# Approach\n1. create a list with K Length( like K boxess)\n2. create an array of length 17 to records value from 1-16 \n\nbackTracking:\n1. move to next new box to take values\n2. dont open new box but loop through previous box to see anyone can take values(box is not full yet)\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\npublic class Solution {\n         int min = int.MaxValue;\n int setLimit = 0;\n public int MinimumIncompatibility(int[] nums, int k)\n {\n     List<(int total,int[] arr)> list = new List<(int total, int[] arr)>();\n     setLimit = nums.Length / k;\n     for(int i =0; i < k; i++)\n     {\n         list.Add((0,Enumerable.Repeat(0, 17).ToArray()));\n     }\n     int[] temp = Enumerable.Repeat(0, 17).ToArray();\n     temp[nums[0]] = 1;\n\n     list[0] = (1, temp);\n     dfs(1, nums, list, 0);\n     return min != int.MaxValue? min:-1;\n }\n public void dfs(int index, int[] nums, List<(int total, int[] arr)> list,int listIndex)\n {\n     if (index >= nums.Length)\n     {\n         // cal the total difference;\n         min = Math.Min(min, cal(list));\n         return;\n     }\n\n     // open a new subSet\n     if(listIndex < list.Count - 1)\n     {\n         list[listIndex + 1].arr[nums[index]] = 1;\n         list[listIndex + 1] = (1, list[listIndex + 1].arr);\n\n         dfs(index + 1, nums, list, listIndex + 1);\n\n         list[listIndex + 1].arr[nums[index]] = 0;\n         list[listIndex + 1] = (0, list[listIndex + 1].arr);\n     }\n\n     for (int i=0; i <= listIndex; i++)\n     {\n         int val = nums[index];\n         //if value is not present and total subset is less than setLimit\n         if (list[i].arr[val] == 0 && list[i].total < setLimit)\n         {\n             list[i].arr[val] = 1;\n             list[i] = (list[i].total + 1, list[i].arr);\n          \n             dfs(index + 1, nums, list, listIndex);\n\n             list[i].arr[val] = 0;\n             list[i] = (list[i].total -1, list[i].arr);\n         }\n     }\n     \n }\n\n public int cal(List<(int total, int[] arr)> list)\n {\n     int sum = 0;\n\n     foreach (var item in list)\n     {\n         int minIndex = 0;\n         while(item.arr[minIndex] ==0)\n         {\n             minIndex++;\n         }\n         int maxIndex = 16;\n         while (item.arr[maxIndex] == 0)\n         {\n             maxIndex--;\n         }\n         sum += (maxIndex - minIndex);\n     }\n\n     return sum;\n }\n\n}\n```
['Backtracking', 'C#']