• Stars
    star
    330
  • Rank 127,657 (Top 3 %)
  • Language
    Python
  • Created over 4 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Solutions for Interview questions appearing in the 6th edition of Cracking the Coding Interview (CTCI)

Cracking the Coding Interview (6th edition) Python Solutions

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

Current progress

Nr. Chapter Done Total Ommited Notes
1 Array and String 9 9
2 Linked Lists 8 8
3 Stacks and Queues 6 6 1
4 Trees and Graphs 12 12
5 Bit Manipulation 8 8
6 Math and Logic Puzzles 10 10 4
7 OO Design 0 12
8 Recursion and DP 14 14
9 System Design 0 8 See the System Design Primer
10 Sorting and Searching 9 11 1
11 Testing 4 6 4
12 C/C++ 11 11 11
13 Java 0 8
14 Databases 0 7
15 Threads and Locks 0 7
16 Moderate 26 26 1
17 Hard 26 26

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.