All of the Solution class's methods except the main method must be thread safe. Make it so both methods can be executed simultaneously by two different threads. "synchronized(this)" isn't suitable here. Use another object for the lock.
A wise man thinks once before speaking twice
You must be signed in to leave a comment
This page doesn't have any comments yet