I recently started a data structures and algorithms course, and got around to the leetcode portion today. I tried the two easiest array questions, and I struggled mightily. Questions that were marked easy I tried to solve for an hour or two. I couldn't solve either of them, and had to look up the answer.
I eventually understood the answers, but I realized that I would not have come to them on my own. I could have tried the problems for the entire day but would not have settled on the solution.
I'm confused about how one gets better at interview questions. Will reasoning through the questions, failing, reasoning through the answer, etc. eventually help me come to these solutions on my own? Are there patterns that one learns eventually that one can apply to various interview questions? It feels like every interview question I'm encountering is this "blue-sky general problem" that I've never encountered before, and I struggle to see how I can apply that solution to other problems. It is so different from practical programming and I struggle with it immensely.
I've built out scalable, data-driven apps from scratch, always seeming to come to the solution. I feel like I'm missing something regarding how to succeed at interview questions. This is the third time I've attempted to grind leetcode, and each time it feels like I'm not a very good programmer, because I can't solve these questions. I want to change my job, but I fear I will never come to interview question proficiency, and it causes me great anxiety.
Any words of advice would be appreciated, thank you.