# Select sublists that contain $n$ odd numbers

I have a list of sublists, let's say

Subsets[Range, {5}]

I need to select only those of them, that contain 3 odd and 2 even numbers, e.g. {{1,4,5,7,8},{2,7,9,10,11},{...}}

lst = Subsets[Range, {5}];
Pick[lst, Count[#, _?EvenQ] & /@ lst, 2]

%  // Length


1176

or

Pick[lst, Dot[Mod[lst, 2] , ConstantArray[1, 5]], 3] (* or *)
Pick[lst, Total[Mod[lst, 2], {2}], 3]
% // Length


1176

• You can use Total /@ Mod[lst, 2] instead of Dot[Mod[lst, 2] , ConstantArray[1, 5]] – OkkesDulgerci Jul 21 '18 at 15:42
• Thank uou @Okkes. I had Total [ Mod[lst, 2], {2}] previously; Thinking it would be faster i changed it to the Dot version. – kglr Jul 21 '18 at 16:38

If the sublists must be ordered:

Union @@@ Tuples[{Subsets[Range[1, 15, 2], {3}], Subsets[Range[2, 15, 2], {2}]}]


Otherwise:

Flatten[Tuples[{Subsets[Range[1, 15, 2], {3}],
Subsets[Range[2, 15, 2], {2}]}], {{1}, {2, 3}}]


where Flatten could alternatively be replaced by
ArrayReshape[#, {Binomial[Ceiling[15/2], 3] Binomial[Floor[15/2], 2], 3 + 2}] &

Union @@@Join @@ Outer[List, Subsets[Range[2, 15, 2], {2}],Subsets[Range[1, 17, 2], {3}], 1]