You can not do it in 2 weightings.
Let's prove it step by step.
Initially you have 8 possible combinations: 1st ball is heavier, 1st ball is lighter, 2nd ball is heavier, .., 4th ball is lighter. So you must be able to set correspondence between outcomes or 2 weightings and 8 combinations.
Ea...
This is a small generalization of well known 12 balls puzzle:
You are given two-sided scale and some number of balls. All balls have the same weight but one. It is of a different weight, although you don't know whether it's lighter or heavier. You are allowed to do only 3 weighings to determi...
sort of unrelated, but i think we need to because the author wouldn't have posted it as 12 if we only needed to do a solution for 4 coins 3 separate times
unless he wanted it to be like the 12 balls problem
so the strategy would be: for every single combination of weights... go through all the possible subsets for each of the 4 weighings and when the pattern gives a unique way to identify the coin weighs... we keep it... then do the next combination of weights and keep the weighing patterns which we identified earlier...
no wait... scratch all that
the outer-most loop is the possible subsets...
then we can abandon if we find a set of subsets which handle all the possible coin-weight combinations