The interviewers are ideally trying to get a sense of how you think through problems, not just that you can spit out an answer you know. At least that's what they say.
It's not the struggle, it's the questions you ask, and what you share about your thought process trying to got to a solution. You might work yourself into a hole solving what you think is a simple array manipulation problem, but then realize some edge cases require you to switch to a heap/priority queue, etc.