what is the best way to find the product of any number of elements from a list?
e.g if I have [a,b,c]
as the input, i should get [a,b,c,a*b,a*c,b*c,a*b*c]
as the output (order of elements for output doesn't matter.)
PS: Can we do it recursively? (e.g you just need the product of a*b
and c
to get the product a*b*c
.
Any idea or suggestion is welcome. Thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…