Doodad
Doodad

To folks who can solve LC Hards

What did it take to get to that point? I'm reasonably comfortable with mediums but hard problems feel like a few notches above in difficulty. Should I find the equivalent rating of mediums on codeforces and work from there? Or is it better to keep reading LC hard solutions until something clicks?

24mo ago
Bransle
Bransle
Droom26mo

A new strategy I have been trying is to look at LC hard questions. Try to think of the solution. Most of the time I can't, so I look up a few solutions and study it until I understand the intuition. Then, I move on to other questions. Then I circle back to the same questions at least a few weeks later. I've found that the time gap lets me forget the code in the solution but I still remember the intuition and I can still solve it. This causes me to start seeing the patterns slowly over time

Afferent
Afferent

A lot of the problems build on top of each other. If you have already solved the easy and medium difficulty for a line of problems, the hard might come naturally. Just keep solving problems. You benefit more from the ones you solve yourself first before looking up the optimal solution.Having said that, there are problems that you will most likely not just come up with the solution. There are algorithms that were invented long ago and are taught in CS courses. Even some easy ones, say bubble sort, you would most likely not come up with them by your own. You need to do some research for those. See the comment, find what algorithm people are recommending, look it up and learn it

Inhumation
Inhumation

I did competitive programming back in highschool. Nothing world class, but reached Master on codeforces (2100ish rating) and solved around 500 problems on CF. Now when I try leetcode,most of the problems (including LC hards) are like easy version of some problem I did before.I guess if you get serious about cp you can get to this level, although it's probably not optimal strategy.

Furbelow
Furbelow

While it sounds good in theory I do think it's not optimal like u said. The lower level divisions for beginners are not your typical LC questions you'll see at all (number theory, puzzles, etc).Sounds good in theory but there's better ways as far as interview prep.I do still enjoy competitive programming though. Scratches the gaming/ puzzle itch I have.

Whorl
Whorl

I'll add that often times the question might require specific domain knowledge about the problem. So unless you've had past experience solving that specific type of problem there might be some assumed knowledge. There are some LC Hards that even after looking at several solutions and YT videos I still do not see how I would even come close to deriving anything near the correct answer. Like I could understand the algorithm/pattern that they use, but a lot of work is done before the actual coding starts.

Discover more
Curated from across