added solution to power N problem