For example, if the input list is
[1, 2, 3, 4]
I want the output to be
[(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
If possible, I would like a solution which is better than the brute force method of using two for loops. How do I implement this?
2^n
figure? Ordered pairs are 4! / (4 - 2)! (== 12) and unordered pairs are 4 choose 2 (== 6)