It seems to be an anxiety issue. There are two ways to fix this, one is temporal and it is to practice. The other is permanent but more difficult and it is to find internal peace. Sadly, how to achieve that goes beyond the scope of this comment.<p>Beyond anxiety, it might serve you a change of perspective.
Don&#x27;t think of the interview as an engineering problem, it is a communication problem. Even if you don&#x27;t finish it, it should be salvageable by explaining all the things you considered and were about to consider. If they don&#x27;t value this, it is their loss. And, Honestly, they did you a favor, a nice place to work would respect your time and listen after making you work on a test.