We can use completmentary counting here. Let Y stand for Ymir and B stand for Bin and C stand for Charles and D stand for Daria. Then, we get that:
There are a total of 4! ways in order to rearrange this letter. However, let's find the opposite of what we want. We can group the term Y and B together and form a new letter, which we can call X. Hence, we get:
There are 3! ways for which we can rearrange XCD, however, we have to multiply this by 2 since X can be rearranged in 2! ways. Hence, we get 3! * 2 = 6 * 2 = 12.
We can now subtract this from 4! = 24, and get 12.
Let x be the length of the shortest triangle. Hence, we know that the length of the longest side is 2x - 4. We also know that the length of the other side is x + 2. Hence:
2x - 4 + x + 2 + x = 16,
4x - 2 = 16,
4x = 18,
x = 9/2
x = 4.5
Hence, the shortest length is 4.5. From this, you should be able to figure out the lengths of the other side on your own.
Let AAAA be the 4 astronomy books, BBB be the biology books, and CC be the chemistry books. We can group the terms into X, Y, Z repsetivley. Hence we get:
There are 3! ways to rearrange this. However, each of the X can be rearranged 4! ways, and the Y can be rearranged in 3! ways, and the Z can be rearragned in 2! ways.
Hence, our answer is:
4! * 3! * 3! * 2!