Since it starts at 7pm and she needs to be there 20 mins early, that means she needs to be there by 6:40pm. There are 60mins in an hour and 60-20=40.
Since it takes her 45 mins to get to the gym, she needs to leave 45 mins earlier than 6:40pm so that is 5:55pm. 6:40 - 45 = 5:45
So she should leave her house no later than 5:55pm