Utility function to sort the slices and their contents
(s [][]int)
| 94 | |
| 95 | // Utility function to sort the slices and their contents |
| 96 | func sortSlices(s [][]int) { |
| 97 | for _, inner := range s { |
| 98 | sort.Ints(inner) |
| 99 | } |
| 100 | sort.Slice(s, func(i, j int) bool { |
| 101 | if len(s[i]) == 0 || len(s[j]) == 0 { |
| 102 | return len(s[i]) < len(s[j]) |
| 103 | } |
| 104 | return s[i][0] < s[j][0] |
| 105 | }) |
| 106 | } |