Q,W,E,R,T,Y,U,I,O,P,A,S,D,F are 14 members belongs to G1,G2 and G3 following G1(Q,W,E,R,T) G2(Y,U,I,O,P,A) and G3(S,D,F) are 3 groups with 14 members in total and get 7 members out of each groups without repeating and where you can select only ( max 3 or 1 member from G1),(max 4 and min 2 from G2) and ( max 2 and min 1 from G3)
function get_members(array_of_groups){ } get_members([[1,2,3,4,5],[6,7,8,9,10,11],[12,13,14]])