Compute monthly CRR with merges and gaps | Google Interview Question