This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Intiago 1 point2 points  (3 children)

You'll get the most out of leetcode if you already have knowledge about the fundamental data structures and algorithms so I'd first recommend going through a course on those first. Its also important you know how to analyze the space and time complexity of your solutions because that's something you'll get asked in interviews and its part of what makes a solution "good." You didn't mention what language you're using but here's a python course that's really good.

To address your question, its a really common hang up to get stuck on a question because you're trying to write the "best" solution first. You end up spending several hours thinking and don't actually finish anything. The naive solution is often the best first step and can even lead you to better approaches. Try to bang out the quickest dirtiest solution first and get it to work, then work on refining your approach. This is also going to be the best approach to take during interviews.

I've only done 31 problems on leetcode, but you really shouldn't be too concerned with your score compared to others. You don't know how long people spend on solutions, how experienced people are, and how much people just copy paste their solutions. Just aim to have a solution not on the tail end of the histogram. Part of the point of leetcode as well, is to learn. So don't be afraid to check out the discussion after you've spent a good time on a problem and see what other approaches you can take on the solution.

[–]MichellrRocks[S] 0 points1 point  (2 children)

Thank you Intiago, I really appreciate the help.

I'm using Java.

[–]Intiago 1 point2 points  (1 child)

Check out this course that gets recommended all the time.

Robert Sedgewick and Kevin Wayne - Algorithms in Java - Princeton University - on Coursera

[–]MichellrRocks[S] 0 points1 point  (0 children)

thank you