Some things i think you could improve:
int main() {
...
return 0;
}
Unlike in C the statement return 0 is automatically generated for main. So its common to omit it.
then this line in the main is problematic as well:
unsigned int N = 0;
unsigned int M = 0;
cin >> N >> M;
You expect you get an unsigned integer from the input. But who says the user types it?
You should better read in as std::string and convert the result to integer after if possible:
for (;;) { std::string input; std::cin >> input;
if (is_convertible_to_integer(input)) { // write a function to check if is convertible to unsigned int
// convert to string
break;
}
}
This can be probaly in a function as well like unsigend int read_unsigend_int();
Then a classic mistake in C++. Don't use using namespace std. It is not a good habit. Read about it here: https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice.
The next thing I wonder. Do you really need unsigend int? Often it is not worth the hassel. It can intriduce hard to spot errors: https://stackoverflow.com/questions/22587451/c-c-use-of-int-or-unsigned-int
Then you create a class just for solving basically some computations. In this case i think its overengineering. It could be simply solved by using free standing functions. Unlike in some other Programming languages were everything is a class you can just use free standing functions.
However it is a good idea to wrap youre functions and classes in its own namespace to prevent name clashes. So do something like:
namespace good_range {
// youre functions and classes
}
Annother small thing:
Solution(const unsigned int _N, const unsigned int _M) : N(_N), M(_M) {}
No need to use const here since you have the values by value copied anyway.