Leetcode Crackbook
Important
Please read this preface before you dive into the book.
About the Book
This website is a practical crackbook for LeetCode-style coding interviews. It focuses on problem-solving patterns rather than individual questions, helping readers build intuition that transfers across problems. Instead of memorising solutions, the content is organised around core techniques—such as sliding windows, recursion, dynamic programming, and graph theory—to reflect how strong interview performance is actually developed.
About the Author
My name is David Zhang, aka Hadjshell on the internet. I've recently graduated from King's College London with a master's degree in Advanced Computing. I am currently fighting for a software engineer job position, probably just like you. May we all get to that dream end🤞.
About the Reason
Many people believe that leetcode is a stupid process of job interviews. It serves as a rigid examination method with little practical value. "Building rockets during interviews, but tightening screws at work." is how we mock it in China. With the rise of AI, it may even seem unnecessary to solve these problems by hand anymore. However, after going through the preparation process myself, I have come to see it differently.
To me, leetcode is not about solving a problem; instead, it teaches me the skill of problem solving. There are more than 3,000 problems on leetcode. It is impossible to solve every problem without a clear mindset. You must learn to analyse the problem, extract patterns, choose appropriate tools, and weigh the trade-offs between different solutions. Does it sound familiar to you? It is exactly how we solve problems in other aspects of life. For our computer scientist, leetcode is not only a great way to forge a better understanding of programming concepts, but more importantly, a way to practice the most valuable skill: problem solving. The amount of AC doesn't really matter - what matters is developing an intuition for the underlying programming world, those mysterious but fascinating 0s and 1s.
Throughout my LeetCode journey, I have read many articles and posts that helped me immensely. This book is my attempt to give something back. If it can help you—even with a single line of code—I would be more than happy 😊.
How to Read
I understand that getting started with LeetCode can be challenging, especially for beginners. However, this is not a book to rush through. The book is organised as follows:
- Each chapter focuses on one core topic, arranged from fundamental to advanced.
- Every topic begins with a discussion of its underlying patterns and practical, real-world tricks, followed by problem sets.
- Problems are further grouped into sub-domains within each chapter and ordered according to LeetCode’s sequence. Each problem includes a correct and concise Java solution.
- Some problems are tagged with ⭐ or ❤️, suggesting their popularities and importance.
- I am continuously working on adding solution notes for every question. Stay tuned for updates!
Read actively and revisit sections often. With consistent practice, the problems will start to feel predictable—and that predictability is the foundation of confident interview performance.
Tips
Feel free to read on your own pace if you have experience.
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives (BY-NC-ND) 4.0 International License.
All problems in this book are copyrighted by LeetCode.
