So I've searched around and honestly can't find a solution.
I'm completely lost, having one of those days.
Let's say I have this set
string[] arr = { "N", "N", "N", "N", "O", "O", "O", "O" };
I want to find all possible unique permutations, where there are never more "O"s than "N"s preceding it.
I.e If at index [2]
, 1 "N"
and 1 "O"
have been already come before it, then arr[2]
must hold an "N"
. ["N","O","N",...]
I want to write a function that can output a 2D array of all permutations that follow these rules for any sized set.
Any help would be greatly appreciated.