When practicing Leetcode problems if you can't figure out the solution in 20 minutes you should probably look at the solution. Some people may disagree with me on this. Why I think you should quit after 20 minutes is because if you can't figure out how to solve the problem after this amount of time you won't be able to figure it out with a couple more minutes. If you do come up with a solution is might not be the most optimized solution. Looking at the solution you can figure out how to get to the optimized solution. You might even have figured out a technique that you didn't know before. Don't spend too much time looking at the solution but do understand it. How did the solver get to the final solution? Doing this over and over again will expose you to a lot of problems. Hopefully later on you will recognize the question or technique you need to solve the problem.
Exposing yourself to many problems is better than understanding the 1 problem in depth. You want to understand how to solve many different problems not just that 1 problem. You only have a limited amount of time until your interview or until someone asks you for an interview.
Thank you for reading.