I think it helps to view things in terms of equilibrium potentials. Once you get it, you can apply the same concepts to any electrolyte they throw at you.



Remember, an equilibrium potential is the cell potential at which the concentration of the electrolyte is balanced by the electrostatic charge across the cell membrane. If an electrolyte is completely free to move across the membrane, the resting potential of the cell will move to the equilibrium potential of that electrolyte.



For K+, the normal equilibrium potential is -85 mV or so, but the resting potential is -70 mV. That means there's a tendency for K+ to try and leave the cell at rest, because doing so would reduce the concentration gradient across the cell membrane. The K+ would continue to leave until the resting potential = the K+ equilibrium potential, at which point the force generated by the concentration gradient would equal that generated by the electrostatic attraction between the positive potassium ion and the negative cell interior. This doesn't happen, however, because the cell membrane isn't perfectly permeable to K+, and because the Na/K pump is constantly pumping in 2K+ for every 3Na+, but all in all it gets pretty close.



In the hypokalemic state, you increase the concentration gradient between the inside and outside of the cell. There was already little K+ outside to begin with relative to the inside of the cell, and hypokalemia makes that worse. That increases the equilibrium potential (i.e., pushes it further negative), because now you need more electrostatic charge to resist an increased concentration gradient. Conversely, in the hyperkalemic state, you decrease the concentration gradient. That means that there's less driving force for K+ to get out of the cell, and you need less electrostatic charge to resist the concentration gradient. Therefore, the equilibrium potential is decreased (i.e., closer to 0 than -85 mV).



So here's the kicker: after the AP upstroke (i.e., repolarization), Na+ channels close, more K+ channels open, and the cell potential is again being driven by the K+ equilibrium potential. The more negative the K+ equilibrium potential, the greater the energy available for repolarization, and the faster you're going to depolarize.



Hypokalemia: more negative K+ equilibrium -> more force pushing K+ out of the cell -> faster repolarization



Hyperkalemia: less negative K+ equilibrium -> less force pushing K+ out of the cell -> slower repolarization