I think each digits hould be different.
We have two numbers of the form: abcde and ABCDE.
We get the greatest sum if we take twice the numbers 87430 , right?
The smallest difference is when we subtracht the bigest number from the smallest, ie. 03478 - 87430, or not?
@Shobhit