I know there's library in python make it easier to produce all possible value. But i want to know the algorithm inside of it.
I expect a function that works like this
def listPossiblePair(length:int,possibleValue:set) -> list:
Consider possible value will show in my case is only 0 and 1.
If the length 3 then the function will return all possibile pair of that possible value
listPossiblePair(3,{0,1})
Will return
[[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]]
Here is another example
Another example:
listPossiblePair(2,{0,1,2})
Will return
[[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2]]