Combinatorial algorithms(permutations, combinations, powersets, subsets et, al) had never been my forte.
Infact, I was quite scared of them.
Presumably an irrational fear that stuck with after a failed effort in my graduate years.
No matter, This weekend, I set out to remedy that.
I didn’t want to read on the algorithms before implementing and decided I’d go pencil-and-paper and implement one that occurs naturally to me.
Here goes the result of that –