According to gym bro science, if the cramping happens during workout, then it's likely K deficiency. If the cramping happens outside of a workout, it is likely Mg deficiency.Could also be a potassium deficiency.
At least in my case that was the problem.
My goto process is: hydrate, take electrolyte supplement, rest, hot/cold, gentle stretch. If your cramp doesn’t respond favorably -> doctor.
I found also that some workout drinks that aid in post exercise recovery can relieve cramping.
Lastly, you may need to avoid coffein.
