The US resolved that with two crews for most of it’s submarines. That way you get 6 months of training and at home time. Most US Merchant Marine sailors also have an enforced 6 months off a year too.
A few of the West Pack Widows were reputed to have had a hot bunk /”Paint Your Wagon” status with members of different crews of the same ship.
I withhold judgement on the practice. Mark Twain’s “Letters from the Earth” suggests that arrangement wouldn’t be much of a problem in a rational world, but Twain was a humorist.
Only missile submarines. Fast attacks have always had a single crew, and generally spend more than 6 months at sea.