Home

Awesome

Cracking the Coding Interview (6th edition) Python Solutions

Existing Python solutions can be found officially here and user-created here

Current progress

Nr.ChapterDoneTotalOmmitedNotes
1Array and String99
2Linked Lists88
3Stacks and Queues661
4Trees and Graphs1212
5Bit Manipulation88
6Math and Logic Puzzles10104
7OO Design012
8Recursion and DP1414
9System Design08See the System Design Primer
10Sorting and Searching9111
11Testing464
12C/C++111111
13Java08
14Databases07
15Threads and Locks07
16Moderate26261
17Hard2626

Running the solutions

For convenience, the project has a setup.py that specifies a package, for local path resolving.
This can be installed locally in the python (virtual)environment by using:

pip install -e .

Problems can be run by running the file, most should have a main method with some sample input, e.g. :

python p16_20.py

Some highlights

Langton's ant (Chapter 16, Problem 22)

Result pattern

An interesting example of emergent patterns from simple rules. Raise the number of iterations in the code to see more of the "highway" form.
For more information, check the wikipedia link.

Tree visualising in VS Code

Example tree

This requires graphviz to be installed locally and the extension added to VS Code.
The one used in the screenshot above can be found here.