Generate All Permutations in Excel using LAMBDA

Cool question and brain teezer; I just puzzled on something which is using MAKEARRAY(): Option 1: What you’d call as “super inefficient” is creating a list of permutations when you calculate rows^columns. I think the following is not that inefficient. Let’s imagine the following: Formula in E1: =LET(A,A1:C3,B,ROWS(A),C,COLUMNS(A),D,B^C,E,UNIQUE(MAKEARRAY(D,C,LAMBDA(rw,cl,INDEX(IF(A=””,””,A),MOD(CEILING(rw/(D/(B^cl)),1)-1,B)+1,cl)))),FILTER(E,MMULT(–(E<>””),SEQUENCE(C,,,0))=C)) In short, what this does: Variables A-D … Read more

All possible permutations of a set of lists in Python

You don’t need to know n in advance to use itertools.product >>> import itertools >>> s=[ [ ‘a’, ‘b’, ‘c’], [‘d’], [‘e’, ‘f’] ] >>> list(itertools.product(*s)) [(‘a’, ‘d’, ‘e’), (‘a’, ‘d’, ‘f’), (‘b’, ‘d’, ‘e’), (‘b’, ‘d’, ‘f’), (‘c’, ‘d’, ‘e’), (‘c’, ‘d’, ‘f’)]

Finding all permutations of array elements as concatenated strings

A fun problem! I wanted to implement using generators. This allows you to work with the permutations one-by-one as they are generated, rather than having to compute all permutations before the entire answer is provided – const input = [“🔴”,”🟢”,”🔵”,”🟡”] for (const p of permutations(input)) console.log(p.join(“”)) 🔴🟢🔵🟡 🟢🔴🔵🟡 🟢🔵🔴🟡 🟢🔵🟡🔴 🔴🔵🟢🟡 🔵🔴🟢🟡 🔵🟢🔴🟡 🔵🟢🟡🔴 🔴🔵🟡🟢 … Read more