Given:
Initial charge given to the capacitor = Q
When the capacitor is connected to a battery, it will charge through the battery. The initial charge will also decay.
The growth of charge across the capacitor due to the battery of emf E,
The decay of charge through the capacitor,
The net charge on the capacitor at any time t,