optimised N-MCS all solutions
Signed-off-by:Syed Asad Rahman <s9asad@gmail.com>