3 ms·
I am by no means good at programming interviews but 1. Generate all subsets of 1-n using the proof of cardinality of the powerset 2. Filter to subsets of size
by divbit 10y ago
I am by no means good at programming interviews but
1. Generate all subsets of 1-n using the proof of cardinality of the powerset
2. Filter to subsets of size k
3. If it's an array of letters, use the filtered subsets to index the array
https://github.com/divbit/tspm/blob/master/example-projectEulerNum51/EulerMath.ts#L51 https://github.com/divbit/tspm/blob/master/example-projectEu...