I am looking for an algorithm for finding the simplest combination of integers from 0 to 5 (that is the one that consists of the fewest number of integers) that has not yet been used (the used combinations are in a list).
The order does matter and the combinations should be returned in a list.
For example, the list with the used numbers could look like this:
{{0},{1},{2},{3},{4},{0,0},{0,1},{0,2},...,{2,1},{2,2},...,{1,5,4},...}
In this case, the algorithm should return a list with {5}, as {5} is the combination that consists of the fewest integers.
If the list looks like this:
{{0},{1},{2},{3},{4},{5},{0,0},{0,1},{0,2},{0,3},{0,5},...}
the algorithm should return a list with 0 and 4 ({0,4}).
As it is to be used in Java, a Java answer is preferable but pseudo-code or other programming languages are usable too.
Thank you in advance!