My personal notes, remarks, and attempts at solving challenges inspired by (and sometimes directly taken from) Harry He's book, Coding Interviews. These are not official or authoritative solutions. Instead, they represent what I tried on my own while learning, and I encourage everyone to also attempt these or similar problems independently.
Important: Some of the problems here do not appear in the book but felt related in scope, so I included them in my study process.
If you’re interested in the book itself, you can find it on Amazon here.
I aimed to modernize or expand on certain approaches while keeping these notes for my personal review:
- Errors are handled with exceptions. Traditional error codes were replaced.
- Input/output is streamlined using
iostream
. The legacystdlib.h
was dropped. - Testing relies on assertions. Traditional console tests were removed.
- Vectors are preffered for data management. Raw arrays were abandoned.
- Looping mechanisms are implemented with iterators instead of integer indexing.
- Code organization is improved with classes.
- Refrences are preffered for variable access. Raw pointers were removed where applicable. When necessary we use smart pointers, mostly
std::unique_ptr
. - Verbose function implementations were trimmed in favor of slim lambdas.
- Data pairing is simplified with STL pairs. Manual grouping methods were discarded.
- Where possible type deduction is clarified with the auto keyword. Explicit type declarations were minimized.
- Not all book problems are covered.
- Some problems are my own or from similar resources (not found in the book).
- The solutions are my personal attempts and may not reflect the book’s exact methods.
# | Title | Notes/Solution |
---|---|---|
1 | Array rotation | C++ |
2 | Duplicates | C++ |
3 | Majority element | C++ |
4 | Merge arrays | C++ |
5 | Min number | C++ |
6 | Permutations | C++ |
7 | Reorder numbers | C++ |
# | Title | Notes/Solution |
---|---|---|
1 | Add numeric string | C++ |
2 | Allocate string | C |
3 | Anagram | C++ |
4 | Combinations | C++ |
5 | Delete char | C++ |
6 | Delete duplicate chars | C++ |
7 | First char appearing once | C++ |
8 | Numeric string | C++ |
9 | Palindrome number | C++ |
10 | Permutations | C++ |
11 | Regex | C++ |
12 | Replace blanks | C++ |
13 | Reverse words in sentence | C++ |
# | Title | Notes/Solution |
---|---|---|
1 | Circular queue | C++ |
2 | Max queue | C++ |
3 | Min in stack | C++ |
4 | Stack push pop order | C++ |
5 | Stream median | C++ |
# | Title | Notes/Solution |
---|---|---|
1 | Clone complex list | C++ |
2 | Delete duplicates | C++ |
3 | Delete node | C++ |
4 | Kth node | C++ |
5 | List implementation | C++ (accompanied by list.h) |
6 | Loops | C++ |
7 | Merge lists | C++ |
8 | Print reversely | C++ |
9 | Reverse list | C++ |
10 | Sort list | C++ |
# | Title | Notes/Solution |
---|---|---|
1 | Binary search matrix | C++ |
2 | Magic square | C++ |
3 | Partially sorted matrix | C++ |
4 | String path | C++ |
# | Title | Notes/Solution |
---|---|---|
1 | Advanced inheritance | C++ |
2 | Arrow and dot | C++ |
3 | Assignment operator | C++ |
4 | Objective C | C |
5 | Shape inheritance | C++ |
# | Title | Notes/Solution |
---|---|---|
1 | Count ones | C++ |
2 | Hamming distance | C++ |
3 | Modify number | C++ |
4 | Number complement | C++ |
5 | Two missing numbers | C++ |
6 | Uniquely occurring numbers | C++ |
# | Title | Notes/Solution |
---|---|---|
1 | Balance | C++ |
2 | Binary tree | C++ (uses binary_tree.h) |
3 | Construct binary tree | C++ |
4 | Convert to list | C++ |
5 | Depth | C++ |
6 | Largest subtrees | C++ |
7 | Lowest ancestor | C++ |
8 | Nodes at k distance | C++ |
9 | Path | C++ |
10 | Print levels | C++ |
11 | Print zigzag | C++ |
# | Title | Notes/Solution |
---|---|---|
1 | Climbing stairs | C++ |
2 | Coin change | C++ |
3 | Edit distance | C++ |
4 | Eight queens | C++ |
5 | Fibonacci | C++ |
6 | Greatest sum subarrays | C++ |
7 | K least numbers | C++ |
8 | Longest increasing path | C++ |
9 | Matrix chain multiplication | C++ |
I’ve been a software engineer for a few years now, mostly working on full-stack projects—designing APIs, optimizing databases, and occasionally dabbling in front-end frameworks. While I’m comfortable solving day-to-day problems at work, I realized I needed a solid refresher on the classic algorithmic challenges often asked in big tech interviews.
So, when I started hearing buzz about Coding Interviews by Harry He, I decided to give it a shot. I’d heard it covers many of the typical interview questions you might face at larger tech companies: from common data structures to algorithmic puzzles that test not just coding ability but also problem-solving and critical thinking.
- Even though I code daily, I don’t always get to practice the kind of purely algorithmic exercises that come up in interviews. It seemed like a good way to brush up on fundamentals.
- Several colleagues and friends mentioned it helped them feel confident going into their interviews.
- I’m a big fan of books that get to the point—especially for busy professionals who want quick coverage of diverse problems.
- The book manages to pack a wide range of topics (arrays, strings, trees, etc.) in a relatively short space. As someone who’s short on time, I appreciated not having to wade through hundreds of pages to find the essential parts.
- Most examples feel grounded in real-world-ish scenarios (though simplified). This was good for me because purely abstract puzzles can sometimes feel disconnected from actual coding work.
- It touches on a lot of the categories big tech recruiters typically ask about—like reversing linked lists, string manipulations, or finding the “maximum something” in subarrays. It was a well-rounded refresher.
- As a visual learner, I’d have liked more diagrams—especially for tree or graph-related problems. A quick tree or flowchart can do wonders for understanding an algorithm’s logic.
- The coverage of topics like dynamic programming and graph algorithms felt a bit too brief. It included some references to DP but didn’t delve deeply into more complex variations. If you’re looking for advanced DP problems (like those involving multiple constraints or multi-dimensional optimization), you might be left wanting more.
- The explanations are often concise, which can be a double-edged sword. While it’s great that the book doesn’t ramble, I occasionally wished the theoretical background had been fleshed out just a little more. If you’re new to a certain data structure or algorithm, you might need to supplement your reading with online resources.
- I’d read a chapter, write down my own notes, and attempt the problems. For tricky ones, I wrote mini solutions on my own first, then cross-checked with the book’s approach to see where I could improve.
- Before a technical interview, I revisited certain chapters (like “Strings” or “Trees”) to make sure I remembered the classic pitfalls and corner cases.
- Whenever I felt something was underexplained, I’d look up articles or videos online to fill in the gaps. This was especially true for more advanced dynamic programming or graph algorithms not deeply covered.
Our testing workflow runs automatically on every push and pull request, giving you peace of mind that your code is continuously checked. It starts by checking out your repository and then smartly separates your source files into two groups: one for library code (files without a main function) and one for tests (files with a main function). The library files get compiled into object files and are bundled into a static library, while your test files are compiled and linked against this library.
Once the test executables are built, each one is run with a 90-second timeout to catch any potential issues early on. If a test fails or takes too long, the workflow stops and lets you know right away, making it easy to pinpoint and fix problems. This human-friendly process ensures that every update you make is both compiled correctly and behaves as expected, keeping your development smooth and reliable.
Feel free to open a pull request or an issue if you spot something that can be improved. Please remember:
- These notes are personal remarks and not a definitive guide.
- I strongly recommend practicing and testing your own approaches.
Disclaimer: These notes are solely my personal study aids and should not be treated as an official or comprehensive guide to Coding Interviews. Purchase the book for the full experience and complete problem statements. Happy coding and learning!