Can we use itertools module from Python?

with the help of combinations function from this module we can find the different combinations of elements and find the prod of elements in that tuple and hence return the max prod.

yes. but doing so will be very slow, of the order of O(n!/k!(n-k)!) for nCk. it probably wont pass all the test cases. You would perhaps like to use some sort of DP to solve those questions