Between them, the two four-digit integers $$M$$ and $$N$$ contain all ten digits from $$1$$ to $$8$$.  What is the least possible difference between $$M$$ and $$N$$? 
Overseas Competition->Knowledge Point->Combinatorics->Combinatorics Involving Extreme Values->Extreme Value in Enumeration Problems
The first digits of the two numbers will need to be as close as possible to each other. Since they cannot be equal, they will have to differ by $$1$$; say they are $$n$$ and $$n + 1$$. The difference between the two numbers will then be minimised by making the four digits after $$n + 1$$ as small as possible and the four digits after $$n$$ as large as possible. The smallest four-digit number available is $$123$$ and the largest is $$876$$. So we need to make $$n= 4$$ and then the required diference is $$5123 - 4876 = 247$$. 