I’ve seen several similar questions about how to generate all possible permutations of elements in an array. But I’m having a very hard time figuring out how to write an algorithm that will output values that are not included in each permutations:
Starting with the following array (with N elements):
var array = ["apple", "banana", "lemon", "mango"];
And getting the following result:
var result = [
"apple not banana not lemon not mango"
"apple banana not lemon not mango"
"apple banana lemon not mango"
"apple banana lemon mango"
"banana not apple not lemon not mango"
...
];