Solve concurrency in Java | Fidelity Interview Question