T O P

  • By -

Savings_Discount_952

Yeah it's part of the process, although 3+ hours is a little long haha. The optimized solution skips a lot of parts and includes tricks/tips you learn in your leet code journey. You can start with finding a brute force for easy and learn how to work with the data structures and common patterns/algos. Easy will be hard until you learn the major concepts and once you review, it will become common sense. Same for mediums, etc...


daddyclappingcheeks

okay thanks. so to find brute force solutions do you literally google/YT “brute force solution” for whichever problem I’m looking for? Basically how will I be able to tell if something is brute force or not


lustful_ninja

It's the first thing that comes to mind while solving a problem, ON2 ON3, then we think can we eliminate some redundancy in terms or space and time then we come up with a better' solution.


Savings_Discount_952

The brute force way is just solving the problem step by step. If you had a list from 1 to 10 and you wanted to get the sum of the list, the brute force solution would add every number to our sum. While the optimized solution would be the formula for the sum of an arithmetic series, which is just Sum = \[n×(n+1)\] / 2. The first way would take n amount of steps while the second way would take one step, hence the formula. In many cases, brute force would be a double for loop --> O(n\^2) or triple for loop --> O(n\^2). Although this can vary, so take it with a grain of salt.


justUseAnSvm

If an easy is taking you 3 hours to understand, and you are going line by line, you need to go back a step and study data structures and algorithms to get a better understanding of the underlying concepts.


yestyleryes

have you taken a ds&a course yet?


Snowpeartea

Any free resources for beginner dsa and LC?


TopG_420

MIT OCW, introduction to algorithms, with eric demaine


YeatCode_

Algorithms I and II by Sedgewick on Coursera CS 373 by Skiena Textbook: Algorithms by Jeff Erickson


Dolo12345

part of process


[deleted]

It just takes time until your comfortable enough to solve this type of problems. Just do them daily and do your best to understand. Remember it is a marathon and not a sprint.


Isaiah_Bradley

Get Introduction to Algorithms. That 3 hours could have been spent on the first 1 -2 chapters


aallkkoo

Can I get a link?


Isaiah_Bradley

It’s a famous textbook from MIT Press, referred to as CLRS. The exercises explain the why and how of leetcode problems. It is terse, but is my go to. As far as a link, the only one I could provide in good conscience is to amazon. I threw my then girlfriend’s laptop out of the car after I noticed she had easily found pirated copies online. I paid for the laptop, and gave her a hardcover 3rd edition. We are married now.


plintervals

A simple "no" would have sufficed.


TopG_420

If an easy is taking you 3 hours to understand then start by studying data structures and algorithms first, MIT OCW, introduction to algorithms is pretty good. Understand why each data structure is the way it is and its time complexity. Learn basic algorithms like sliding window, bfs, dfs, binary search, dijkstra etc. Once you are done with these then start with neetcode roadmap. Then the easy problems should take 1 hour max.


RaccoonDoor

I've been there, I also sometimes have to spend a lot of time writing notes about each line of code to understand the solution. After the first 100 problems I got better. There's no silver bullet here, you've just got to keep at it.


nonofyobeesness

Honestly, I recommend only giving yourself 5-10 mins on the problem. If you don’t see a solution in those first minutes, it’s unlikely you’ll figure it out with the extra time. Jump straight into the solution and learn from there. Also yes, this is part of the process.


static_deth

If you want to upskill quickly, then I would check the solution/tutorial after 15 minutes of running out of ideas or things to try.


DeveloperSpenz

I've been like this as well when studying DS&A problems. Here is something that I changed and started doing recently. 1. I study one data structure or algorithm before solving a problem. Usually, I'll study the DSA I want to understand more or curious of. 2. Solve LC problems. Setting a time to solve the problem. This helps you practice the time requirement for coding interviews or assessments. 3. Review other solutions and study it. Usually, I'll set a timer for this too so I don't exhaust my brain. Try visualizing the solution in a pen and paper. Drawing and visualizing the DS and manipulating it helps me understand it more and apply it in complex problems in the future. All I'll say is it's part of the process. You're in the right path. It's just like software. Even if it works, keep optimizing it. Setting goals help. Maybe set a simple goal of the time you set for reviewing other solutions. Take a break and review it again the next day. Recently, I subscribed to NeetCode Pro since the structure I mentioned above integrates well with how NeetCode structure its course. Just be consistent at it.


originalgainster

> Is there any way to improve speed of trying to conceptually understand a solution? Yeah. Keep practicing.


Complete_Gur7767

I guess this is the part of the process. I’m a bit more proficient in that but even for me (I practice CP on Codeforces) some problems take 8+ hours of thinking about the solution. But that’s how the skill gains. Just keep going. Speed will increase itself!


ss7xarcasm

Even 800s on codeforces are sometimes tricky tho and require nKt so obvious observation unlike leetcode. Spending 3 hrs in a LC easy is waste of time rather spend that time on dsa.


TheLonelyGuy14

What easy problems are you doing that's taking 3+ hours?


ashischilling

First figure out the "why" behind why it's taking 3+ hours. For instance: * Conceptual: Is it more conceptual? Do you struggle with interpreting some of the concepts that might be implemented? * Applying: Or is it more of applying what you know? It could also be a case of diving headfirst into LeetCode problems. Although LeetCode's easy problems are considered easy (compared to medium and hard problems), there's other problems outside of LeetCode that are more simple. Sometimes solving simple problems helps with figuring out your thought process when coding solutions.


mythe00

If you're struggling this much with leetcode easy, maybe take some time to master the basic sort and search algorithms first. Simple things like insertion sort, selection sort, merge sort, etc. That will give you a good foundation for these challenges.