When you get stuck, start talking. You should not be silent at the whiteboard trying to flash out a complete solution all at once. Talk. Even if interviewers are not saying anything or ask you any more questions. There are multiple advantages of talking while writing code at the whiteboard. Firstly, you show the interviewers the way you think and approach the problem. It is as important as actually solving the problem. Secondly, if you get stuck or start making unreasonable assumptions about the problem, the interviewers will have a chance to quickly correct you or give you a hint. Thirdly, it shows that you can communicate. Nobody wants to hire a person who can't communicate with other people.