3 ms·
Any combination where all consecutive numbers are present is unsolvable. That is [1..n], in any order. That's because it is impossible to split any number, bec
by GuB-42 3y ago
Any combination where all consecutive numbers are present is unsolvable. That is [1..n], in any order.
That's because it is impossible to split any number, because it will create a duplicate, it is also impossible to merge, because it will either create a duplicate or a number >n
[2..n] (in any order) is also unsolvable for the same reason. And certainly many others ex:[1,2,4], finding if a problem is solvable is interesting in itself. A good solver should nor only find the shortest solution(s) if there is one but also determine if it is solvable. An interesting problem in itself.