I did'nt understand which method should use in Solution class for waiting until the thread ends. Should I use join() method or any other method?