It's important to know that when poles have the same nature, the force is repulsive. But, when the poles have different nature, the force will be attractive.
Therefore, for case a, the force is repulsive because the two north poles have the same nature. For case b, the force is attractive because the poles are of opposite nature.