suppose there is the following list:
l={{{3, 3, 3, 2}, {3, 3, 3, 1, 1}, {3, 3, 2, 2, 1}, {3, 3, 2, 1, 1,
1}, {3, 3, 1, 1, 1, 1, 1}, {3, 2, 2, 2, 2}, {3, 2, 2, 2, 1, 1}, {3,
2, 2, 1, 1, 1, 1}, {3, 2, 1, 1, 1, 1, 1, 1}, {3, 1, 1, 1, 1, 1, 1,
1, 1}, {2, 2, 2, 2, 2, 1}, {2, 2, 2, 2, 1, 1, 1}, {2, 2, 2, 1, 1,
1, 1, 1}, {2, 2, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1,
1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {{3, 3, 3, 3}, {3, 3, 3, 2,
1}, {3, 3, 3, 1, 1, 1}, {3, 3, 2, 2, 2}, {3, 3, 2, 2, 1, 1}, {3,
3, 2, 1, 1, 1, 1}, {3, 3, 1, 1, 1, 1, 1, 1}, {3, 2, 2, 2, 2,
1}, {3, 2, 2, 2, 1, 1, 1}, {3, 2, 2, 1, 1, 1, 1, 1}, {3, 2, 1, 1,
1, 1, 1, 1, 1}, {3, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 2, 2, 2, 2,
2}, {2, 2, 2, 2, 2, 1, 1}, {2, 2, 2, 2, 1, 1, 1, 1}, {2, 2, 2, 1,
1, 1, 1, 1, 1}, {2, 2, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}}
I want to follow elements that satisfy the following conditions:
- each element at most can have one 3s.
- each element at most can have three 2s.
- each element at most can have three 1s.
Such that I get,
{{{3, 2, 2, 2, 1, 1}}, {{3, 2, 2, 2, 1, 1, 1}}}
and the rest of elements are dropped. Is there a way to have more than one condition when selecting in a list/array in this case?