ii)
If not separated:
3 digits can either be together all at once (all 3 considered as 1
unit)
num of ways like that = 6!(5 letters + 1 group) * 3!(within the
group) = 4320
or
2 digits together (as 1 unit) and 1 further apart
num of ways = 7! * 3C2 * 2! = 30240
However, this includes 2 instances where all 3 digits are
together
eg YYX and XYY (YY represents the 2 digits together, and X is that
1 solo digit)
Hence, total ways without 3 digits together
= 30240 - 4320 - 4320 = 21600
So, for all 3 digits to be separated,
ans = 8! - 4320 - 21600 = 14400
Alternately, after having done iii, there's another more efficient
method
3 L 2 L 1 (L denotes a letter)
For these, there are 3! *5C1 * 4C1 ways = 120 ways
(2! not needed between the 2 letters because already included in
the choose)
We have then 4 slots to slot in the remaining 3 letters
if 3 letters together, that is 4C3 * 3!
if 2 letters together and 1 letter away, then 4C2 * 3! (exchange
letters) * 2! (switch the position between the 2 letter group and
the 1 letter)
if all separate, then 4C3 * 3!
total ways = 24 + 72 + 24 = 120
Hence, total number of ways = 120 * 120 = 14400
iii)
A B C D E
we have to insert 321 inside
for 321 to be together, we have 6C1 choices
for 32 to be together, and 1 separate,
we have 6C2 choices = 15
for 3 separate, and 21 together, same as previous, 15 ways
for 3, 2 and 1 to be separate, you can count also
there are 6C3 choices = 20
total = 6 + 15 + 15 + 20 = 56