Enhancing quantum sensing sensitivity by a quantum memory