My general general steps and main takeaways from solving all the leetcode problems.
- Observe: Manually walk through sample data. Detect the characteristics. This is the most important thing.
- Examine: One normal cases. And one corner case.
- Improve: Can I do better, in terms of time or space complexity?
- Review: Have I seen anything similar? What are they connections and common pitfalls.
- Discussion: Do you feel comfortable to read and learn good solutions from others? It might be very tough. Or you just feel too proud of yourself to listen to others.
Image credits to link
- If you can’t estimate the complexity of your soltion, you don’t understand it well enough
- If you target in improving your daily skills, focus more on easy/medium leetcode problems.
- Sometimes we can simplify the tedious logic in an creative but non-intuitive way.
- If your code has too many trivial checks, you might do it in a wrong way. There shall be better approaches in most cases.
- You know the idea, how fast you can finish the coding? And Bug-free?
See more blog_posts.
Share It, If You Like It.