Leetcode journey
https://betterprogramming.pub/stop-mindlessly-grinding-leetcode-study-smart-instead-8dd6ee6d8c23
What to keep in mind while this journey.
I would just keep doing questions, try to train yourself into thinking more efficiently. Coming up with things like multiple pointers and sliding windows aren't out of the realm of possibility. So as you learn some, make sure you understand them, then see if they fit future problems. If they don't then use them as inspiration for coming up with your own algorithms, you may stumble upon ones that exist already. This way you train your brain to think it out instead of recall previous algorithms. That is ultimately the point, but never seems to actually work that way. There are some bread and butter algorithms you should know going in.
Breadth first search, depth first search, sliding window type is good to know as you have seen, as well as unify-find which you will come across less often but is a great solution for when you do. If you get stuck, think of the brute force method, the one that would take the longest time but work. Then see if you can figure a way to make it more efficient, what items can you immediately discard from searching? Could spending O time for a sort help in the long run?
Comments
Post a Comment