It's OK to look at solutions
A friend of mine told me: "I feel demotivated because I can't come up with solutions myself."
I asked: "Ok, when did you start preparing?"
Him: "A month ago."
Me: "Well then why are you stressed? You just started. If you can't figure out a question in 15 minutes, just look at the solution. Slowly you'll build intuition. Why aren't you looking at the solution?"
Him: "Well, on Leetcode, it looks like everyone is solving problems, just not me. Sometimes I spend 2 hours thinking about a problem and can't solve it. I feel like if I don't solve it, I'm not good enough."
Me: "You're being too hard on yourself. At the beginning, you won't be able to solve problems yourself. Just study solutions, code them, and move on. After 50 problems or so, you will start building skills."
Him: "Ah, I had never thought of it that way. I just felt like I was inadequate."
I kid you not, this was a real conversation. People are feeling the stress. For no reason.
Let's say you're preparing for a test on quadratic equations. Let's assume you've never done them before.
You start preparing for the test. You look at easy equations. Do you expect to solve them rightaway? No, you need to know the techniques first. Then you need to practice with multiple questions. Then, you feel comfortable on the test.
It's no different in algorithm interviews. When you start out, you will need help. Look at solutions. It's ok.
Many engineers think - if I can't solve a problem myself, I'm not a good engineer. Just because you can't solve an easy problem doesn't mean you're a bad engineer.
Disconnect your day job with the interview process. You might be great at your job, but here, you're starting as a beginner.
Look at solutions if you can't find one. It's ok. You will get better with time.