For Caroline Li and Colin Wang, moving in together after dating for eight months was a matter of serendipity and urgency.

Last fall, Mr. Wang, 28, was completing his final year of medical school at the University of California, Los Angeles, when he learned that the two-bedroom apartment he shared with one roommate had a mold infestation. He had to move out immediately, but had trouble finding new housing.

“It was very difficult to find something that was pretty close to campus that was reasonable in price, and it was also in the middle of the school year,” said Mr. Wang, who had reached U.C.L.A.’s three-year limit on student housing, which allowed him to pay $1,425 per month in rent instead of the market rate of $2,000 or more.

At the same time, Ms. Li, 24, a registered nurse, learned that one of her two roommates was moving out of their $5,000-a-month, three-bedroom apartment near Santa Monica, Calif., in the middle of their lease. Ms. Li and Mr. Wang realized that they could resolve both of their issues by having Mr. Wang move in with Ms. Li and her roommate.

Ms. Li and the roommate each pay $1,750 per month, and Mr. Wang pays $1,500.

“I think the plan was always for Colin and I to move in once he completed his residency, not once he graduated medical school,” Ms. Li said. “But I guess the opportunity presented itself earlier, and we were able to keep this apartment and save some money while doing it.”