Hey, don’t worry, struggling is part of the process. In fact, you should expect to struggle, not because you can’t do it, but because algorithms in general are difficult, because our brains don’t usually think that way.
Trust me, I used to absolutely SUCK at algorithms. I was so bad at them that I couldn’t even get through the basic ones without looking at hints or solutions. But, eventually I was able to complete the basic ones on my own without looking at hints (and I wouldn’t look at solutions at this point, since that would only be cheating myself). I restricted myself to only looking at MDN docs for concepts like manipulating strings, arrays, etc, and I was able to do it.
I still struggle on the intermediate ones (I’ve only solved 7 on my own so far). What I’ve come to realize is sometimes you have to take a break and do something else. For me, I would try to solve some algorithms, and once I felt that I’ve hit a wall, I would work on projects or the next certification. Then, when I felt that I wanted to do something else, I went back to the algorithms. It’s funny, I forget which algorithm it was, but before I struggled so hard trying to figure out why my solution didn’t work. It was driving me nuts. It was only after coming back to it after sometime that I was able to solve it easily. It was to the point where I laughed at myself saying “how the hell did I do that?”. And trust me, I’m no genius. Sometimes I struggle hard when learning something new to the point where I feel stupid.
My point is, don’t give up. If you feel like you’ve hit a wall solving algorithms, and you feel like pulling your hair out, step away and proceed to the next cert or build some projects and come back to it later. You’ll surprise yourself.
Also, I’ve come to realize that a huge part of becoming a web developer is learning how to work through self doubt. I can’t tell you how many moments I’ve had where I’ve felt depressed because I couldn’t solve something or I couldn’t understand a concept. It’s OK to have those feelings. Just don’t stop and keep going. Take breaks. Hell, sometimes when you’re so frustrated you have to call it a day. But come back to it the next day. You’ll make progress, trust me. Just don’t stop!