Solution to the King's Problem in prime power dimensions