itertools.combinations() module in Python to print all possible combinations
When given an array of size n, one common problem is generating all possible combinations of r elements. For example: Input: arr[] = [1, 2, 3, 4], r = 2Output: [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)] Although, there can be a recursive solution for this problem, but in this article we'll foc