case by case. Read contract firstly.
If no mention in contract, you need contact with landlord to discuss it. Usually, you can find someone to take your apartment, then it should be Ok (but some landlord don't like it). Or you need pay one extra month to end the contract. It totally depends on the landlord. Good luck.