Friday Puzzler - Listing all posibilities of a set

Today’s puzzle is pretty simple, but I’m curious to see how people solve it. Write a UDF that takes two arguments. The first argument is a set - and by that I mean a list of possible values. So a set could be: A,B,C. The second argument is the length of a string to generate. So given: arrResults = func(“A,B,C”,2) the result would be an array of every possible string combination. Like so:

AA AB AC BA BB BC CA CB CC

Good luck!

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments