I dont have any code, as I said I have 2 vectors , numberSet2 is sorted by size. I do not know how to check if a vector can fit into the sequencing of another vector. So infact yes I would like to look at somebody else's code, complicated or not. That will at least give me the opportunity to break down whats happening and learn something new while accomplishing a task of mine.
Correct me if I misunderstand you ("fit sequentially" is not a well-known term), but you're asking whether two sorted sequences, such as {21,24} and {20,22,23,25,26,27} form a continuous integer range when merged?
You could use std::merge to do the merge, and then compare it for equality with the range of the same size and starting value:
There is also std::set_union that differs from std::merge a tiny bit: if same value occurs in both sets, then result.size() < set1.size() + set2.size()
Both algorithms require sorted input. The OP test will fail if either input set contains duplicate values.
Also note that on success, result.front() + result.size() == result.back() + 1.
std::adjacent_difference does potential stuff too.
"Is there any way"? Yes, many ways. If you know your input well, then you might avoid some brute force.