0

I have a scenario where user is allowed to select few attributes attribute1, attribute2 and so on. These attribute1, attribute2 are themselves list and if there is any selection were made, they are stored in them. If no selection made, then the list will be empty list. How to properly generate the combinations even in case of one of them is empty? For example:

Case1: attribute1 = ["a", "b"], attribute2=["1", "2"] => result = ["a1", "a2", "b1", "b2"]

Case2: attribute1 = ["a", "b"], attribute2=[] => result = ["a", "b"] and so on.

Also these lists are driven by user multi-selection from the dropdowns. Based on user selection, there could be attribute3, attribute4 and so on.

I saw few similar post solving the combinations but they do not consider the empty list. Please let me know if you have any suggestions.

Senthil
  • 183
  • 2
  • 11

1 Answers1

0

In this case, empty list(s) if any exists, those needs to be eliminated before generating the combinations. Those empty lists just creating confusion and disrupting generating the combinations. enter image description here

Senthil
  • 183
  • 2
  • 11