Quantum first-passage problem