"Crossed my mind" is different. It means more like "occurred to me", and "it came to me" is more like you unconsciously figured it out. "I realized that" works, but it would need support from the surrounding text more than "I came to the realization".