How do you do at other parts of the interview? The background interview where you talk about a technical project from your past, or the behavioral interview where you talk about situations you have been in before and how you reacted?
If you are feeling confident after those, and it is just the live-coding session, I'd suggest being upfront about it and asking for a different type of assessment. Ask for a take home assignment, or ask to be left alone to complete the task, and then review the code with the interviewer where you can explain all of the tradeoffs you made and why. The better companies are open to making accommodations for candidates, so if they are not open to this, that is a sign of how rigged the thinking at that company may be.
On the other hand, if you are struggling with the other interview types as well, you may need to dip into some psychological tricks to get your head in the right mindset. One counter-intuitive thing to do is to tell yourself that you do not want this job. If you can convince yourself to believe that, it will lower the pressure you may be putting on yourself and open you mind to think more clearly.
Thanks for your reply, funnily enough the system design / previous project portions of interviews usually go much better for me. This last interview I did I got a very high score on the system design conversation but failed the coding portion miserably.
I’m not sure why that is the case for me, it’s almost like because it’s supposed to be more of a conversation I loosen up more instead of what I usually get during my live coding interviews which is “here is the link, good luck!” then silence from the interviewer for 45 min.
I have observed in the past that I’m worried about not communicating enough and communicating too much during the live coding portions, so that is definitely an extra hoop to jump through that’s hard for me to not think about during the interview