for 40 to be the maximum of all three, the remaining BOTH places can be filled with numbers between 1 and 40 excluding 10
so total ways = 39*39 (since it is nowhere mentioned that repetetion of numbers isn't allowed)
for numbers in which 10 is the least the remaining BOTH numbers can be filled with numbers between 10-50 excluding 40
so, total ways=40*40
So, total number of selections possible are (39*39)+(40*40)
3121 ways
@manasi
While taking 40 as the max value you have to NOT include 10 in your selections since that would be the case where greatest is 40 AND least is 10 but in the question it is asked ... cases for whihc either 40 is greatest OR 10 is least, both conditions being satisfied simueltaneously is not to be considered... thats what I think.
Your views please.