some ideas for the CountDistinctSlices problem