5. Generalize all three parts of the previous problem to

Question
5. Generalize all three parts of the previous problem to an arbitrary number of things given, an arbitrary

number of things selected, with gaps of arbitrary length.