Bunuel
Consider all the six digit numbers that can be formed using the digits 1, 2, 3, 4, 5 and 6, each digit being used exactly once. Each of such six digit numbers have the property that for each digit, not more than two digits, smaller than that digit, appear to the right of that digit. What is the number of such six digit numbers having the desired property?
A. 81
B. 160
C. 161
D. 162
E. 324
We can use numbers such as 123654, the aim to make sure on the right of 6,5,4, there are only 0, 1 or 2 digits smaller than them. The important numbers to place are 4, 5, and 6, since 3 2 1 can be placed anywhere. We will accept _ 4 5 6 _ _ for example but not _ 4 6 5 _ _ as on the right of 6 there are 3 numbers smaller than it.
I split the cases according to where the placements of 4, 5, and 6 are.
Case 1: _ _ _ 4 5 6. We can scramble 4 5 and 6. Thus there are 3*2 cases for the first 3 blanks and 3*2 cases for the last 3 digits. 6*6= 36 cases.
Case 2: _ 4 5 6 _ _. Note we are allowed to move the 5 towards the right and 6 towards the right. The last 4 placements can be randomized except for the _465_ _, _46_5_, and _46_ _5 case. Then we have 4*3 - 3 = 9 scenarios of 6 cases each, 54 cases.
Case 3: _ _ 4 5 6 _, or _ _ 546 _, or _ _ 564 _. In all cases, we are allowed to randomize the last 3 placements (so the last two scenarios overlap, only counts as one). Thus this is 2 * 6 * 6 = 72 cases.
In total 36 + 54 + 72 = 162.
Ans: D