10048

 

729

Using Back Track Algorithm:

Using Next_permutation() method in C++

 

10193