arpankg
ctci-python-solutions

Cracking the Coding Interview in Python 3. The solutions all have detailed explanations with visuals.

Last updated Jun 26, 2026
1.1k
Stars
158
Forks
1
Issues
0
Stars/day
Attention Score
42
Language breakdown
No language data available.
โ–ธ Files click to expand
README

Cracking the Coding Interview in Python - Solutions with Explanations

Detailed explanations to the coding interview questions in CTCI. The solutions are written in Python 3.

If you find this useful, a Github star would be much appreciated!! โญ โญ โญ

Arrays and Strings

|Problem Number | Problem Name | Status| |--- | --- | --- | | 1.1 | Is Unique | Read Solution โœ… | | 1.2 | Check Permutation | Read Solution โœ… | 1.3 | URLify | Read Solution โœ… | 1.4 | Palindrome Permutation | Read Solution โœ… | 1.5 | One Away | Read Solution โœ… | 1.6 | String Compression | Read Solution โœ… | 1.7 | Rotate Matrix | Read Solution โœ… | 1.8 | Zero Matrix | Read Solution โœ… | 1.9 | String Rotation | Read Solution โœ… |

Linked Lists

| Problem Number | Problem Name | Status | | --- | --- | --- | | 2.1 | Remove Dups | Read Solution โœ… | | 2.2 | Return Kth to Last | Read Solution โœ… | | 2.3 | Delete Middle Node | Read Solution โœ… | | 2.4 | Partition | Read Solution โœ… | | 2.5 | Sum List | Read Solution โœ… | | 2.6 | Palindrome | Read Solution โœ… | | 2.7 | Intersection | Read Solution โœ… | | 2.8 | Loop Detection | Read Solution โœ… |

Stacks and Queues

| Problem Number | Problem Name | Status | | --- | --- | --- | | 3.1 | Three In One | Read Solution โœ… | | 3.2 | Stack Min | Read Solution โœ… | | 3.3 | Stack of Plates | Read Solution โœ…| | 3.4 | Queue via Stacks | Read Solution โœ… | | 3.5 | Sort Stack | โŒ | | 3.6 | Animal Shelter | โŒ |

Trees and Graphs

| Problem Number | Problem Name | Status | | --- | --- | --- | | 4.1 | Route Between Nodes | โŒ | | 4.2 | Minimal Tree | โŒ | | 4.3 | List of Depths | โŒ | | 4.4 | Check Balanced | โŒ | | 4.5 | Validate BST | โŒ | | 4.6 | Successor | โŒ | | 4.7 | Build Order | โŒ | | 4.8 | First Common Ancestor | โŒ | | 4.9 | BST Sequence | โŒ | | 4.10 | Check Subtree | โŒ | | 4.11 | Random Node | โŒ | | 4.12 | Paths with Sum | โŒ |

Bit Manipulation

| Problem Number | Problem Name | Status | | --- | --- | --- | | 5.1 | Insertion | โŒ | | 5.2 | Binary to String | โŒ | | 5.3 | Flip Bit to Win | โŒ | | 5.4 | Next Number | โŒ | | 5.5 | Debugger | โŒ | | 5.6 | Conversion | โŒ | | 5.7 | Pairwise Swap | โŒ | | 5.8 | Draw Line | โŒ |

Object Oriented Design

| Problem Number | Problem Name | Status | | --- | --- | --- | | 7.1 | Deck of Cards | โŒ | | 7.2 | Call Center | โŒ | | 7.3 | Jukebox | โŒ | | 7.4 | Parking Lot | โŒ | | 7.5 | Online Book Reader | โŒ | | 7.6 | Jigsaw | โŒ | | 7.7 | Chat Server | โŒ | | 7.8 | Othello | โŒ | | 7.9 | Circular Array | โŒ |

Recursion and Dynamic Programming

| Problem Number | Problem Name | Status | | --- | --- | --- | | 8.1 | Triple Step | โŒ | | 8.2 | Robot in a Grid | โŒ | | 8.3 | Magic Index | โŒ | | 8.4 | Power Set | โŒ | | 8.5 | Recursive Multiply | โŒ | | 8.6 | Towers of Hanoi | โŒ | | 8.7 | Permutation without Dups | โŒ | | 8.8 | Permutation with Dups | โŒ | | 8.9 | Parens | โŒ | | 8.10 | Paint Fill | โŒ | | 8.11 | Coins | โŒ | | 8.12 | Eight Queens | โŒ | | 8.13 | Stack of Boxes | โŒ | | 8.14 | Boolean Evaluation | โŒ |

Sorting and Searching

| Problem Number | Problem Name | Status | | --- | --- | --- | | 10.1 | Sorted Merge | โŒ | | 10.2 | Group Anagram | โŒ | | 10.3 | Search in Rotated Array | โŒ | | 10.4 | Sorted Search, No Size | โŒ | | 10.5 | Sparse Search | โŒ | | 10.6 | Sort Big File | โŒ | | 10.7 | Missing Int | โŒ | | 10.8 | Find Duplicates | โŒ | | 10.9 | Sorted Matrix Search | โŒ | | 10.10 | Rank from Stream | โŒ | | 10.11 | Peaks and Valleys | โŒ |

Moderate

| Problem Number | Problem Name | Status | | --- | --- | --- | | 16.1 | Number Swapper | Read Solution โœ… | | 16.2 | Word Frequencies | Read Solution โœ… | | 16.3 | Intersection | โŒ | | 16.4 | Tic Tac Win | โŒ | | 16.5 | Factorial Zeros | โŒ | | 16.6 | Smallest Difference | โŒ | | 16.7 | Number Max | โŒ | | 16.8 | English Int | โŒ | | 16.9 | Operations | โŒ | | 16.10 | Living People | โŒ | | 16.11 | Diving Board | โŒ | | 16.12 | XML Encoding | โŒ | | 16.13 | Bisect Squares | โŒ | | 16.14 | Best Line | โŒ | | 16.15 | Master Mind | โŒ | | 16.16 | Sub Sort | โŒ | | 16.17 | Contiguous Sequence | โŒ | | 16.18 | Pattern Matching | โŒ | | 16.19 | Pond Sizes | โŒ | | 16.20 | T9 | โŒ | | 16.21 | Sum Swap | โŒ | | 16.22 | Langton's Ant | โŒ | | 16.23 | Rand7 from Rand5 | โŒ | | 16.24 | Pairs with Sum | โŒ | | 16.25 | LRU Cache | โŒ | | 16.26 | Calculator| โŒ |

Hard

| Problem Number | Problem Name | Status | | --- | --- | --- | | 17.1 | Add Without Plus | โŒ | | 17.2 | Shuffle | โŒ | | 17.3 | Random Set | โŒ | | 17.4 | Missing Number | โŒ | | 17.5 | Letters and Numbers | โŒ | | 17.6 | Count of 2s | โŒ | | 17.7 | Baby Names | โŒ | | 17.8 | Circus Tower | โŒ | | 17.9 | Kth Multiple | โŒ | | 17.10 | Majority Element | โŒ | | 17.11 | Word Distance | โŒ | | 17.12 | BiNode | โŒ | | 17.13 | Re-Space | โŒ | | 17.14 | Smallest K | โŒ | | 17.15 | Longest Word | โŒ | | 17.16 | The Masseuse | โŒ | | 17.17 | Multi Search | โŒ | | 17.18 | Shortest Supersequence | โŒ | | 17.19 | Missing Two | โŒ | | 17.20 | Continuous Median | โŒ | | 17.21 | Volume of Histogram | โŒ | | 17.22 | Word Transformer | โŒ | | 17.23 | Max Black Square | โŒ | | 17.24 | Max Submatrix | โŒ | | 17.25 | Word Rectangle | โŒ | | 17.26 | Sparse Similarity | โŒ |

If you find this useful, a Github star would be much appreciated!! โญ โญ โญ

Contributing

Pull requests are welcome. For major changes, please open an issue to discuss what you want to change.

Contributors

Huge thanks to our contributors!

ยฉ 2026 GitRepoTrend ยท arpankg/ctci-python-solutions ยท Updated daily from GitHub