I just wouldn’t work for a company like that. The way they treat you at the interview is a pretty good indicator of how they’ll treat you as an employee.
I don’t understand where this fad of interviewers using these “gotcha” questions. It’s not a good measure of a potential candidates performance as a coder.