https://github.com/avidlearnerinprogress/ctci-solutions
C++ and Python Solutions from the book "Cracking the coding interviews"
https://github.com/avidlearnerinprogress/ctci-solutions
cpp11 cracking-the-coding-interview ctci-6th ctci-solutions python3
Last synced: about 2 months ago
JSON representation
C++ and Python Solutions from the book "Cracking the coding interviews"
- Host: GitHub
- URL: https://github.com/avidlearnerinprogress/ctci-solutions
- Owner: avidLearnerInProgress
- Created: 2019-05-28T05:26:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-14T06:30:43.000Z (over 5 years ago)
- Last Synced: 2025-04-10T23:04:05.404Z (about 2 months ago)
- Topics: cpp11, cracking-the-coding-interview, ctci-6th, ctci-solutions, python3
- Language: C++
- Size: 666 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Cracking the Coding Interview (CtCI) Solutions"
This repository contains C++ and Python solutions to the problems in the sixth edition of [Cracking the Coding Interview](http://www.crackingthecodinginterview.com/) by [Gayle Lackmann McDowell](http://www.gayle.com/).
### Chapter 1:
* Is Unique - _Determine if a string has all unique characters_ **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#is-unique)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/Is%20Unique/is_unique.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/Is%20Unique/is_unique.cpp)_**
* Check Permutation - _Check if one string is a permutation of another_ **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#check-permutation)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/Check%20Permutation/check_permutation.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/Check%20Permutation/check_permutation.py)_**
* URLify - _Replace all spaces in string with '%20'_ **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#urlify)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/URLify/urlify.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/URLify/urlify.py)_**
* Palindrome Permutation - *_Check if string is permutation of its palindrome_* **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#palindrome-permutation)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/Palindrome%20Permutation/palindrome_permutation.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/Palindrome%20Permutation/palindrome_permutation.py)_**
* One Away - *_Check if two strings are one or zero edits away_* **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#one-away)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/One%20Away/one_away.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/One%20Away/one_away.py)_**
* String Compression - *_Perform string compression using counts of repeated characters_* **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#string-compression)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/String%20Compression/string_compression.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/String%20Compression/string_compression.py)_**
* Rotate Matrix - *_Rotate given nxn image by 90 degrees inplace_* **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#rotate-matrix)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/Rotate%20Matrix/rotate_matrix.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/Rotate%20Matrix/rotate_matrix.py)_**
* Zero Matrix - *_Replace other elements in rows and columns if element is 0_* **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#zero-matrix)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/Zero%20Matrix/zero_matrix.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/Zero%20Matrix/zero_matrix.py)_**
* String Rotation - *_Check if string s2 is rotation of string s1 using isSubstring()_* **_→_** **[Overview](/Chapter%201%20-%20Arrays%20and%20Strings#string-rotation)**
* **_[C++](/Chapter%201%20-%20Arrays%20and%20Strings/String%20Rotation/string_rotation.cpp)_** **|** **_[Python](/Chapter%201%20-%20Arrays%20and%20Strings/Zero%20Matrix/string_rotation.py)_**### Chapter 2:
* Remove Dups - *_Remove duplicates from unsorted linked list_* **_→_** **_[C++](/Chapter%202%20-%20Linked%20Lists/Remove%20Dups/remove_dups.cpp)_** **|** **_[Python](/Chapter%202%20-%20Linked%20Lists/Remove%20Dups/remove_dups.py)_**
* Return Kth To Last - *_Find kth to last element of singly linked list_* **_→_** **_[C++](/Chapter%202%20-%20Linked%20Lists/Return%20Kth%20To%20Last/return_kth_to_last.cpp)_** **|** **_[Python](/Chapter%202%20-%20Linked%20Lists/Return%20Kth%20To%20Last/return_kth_to_last.py)_**
* Delete middle node - *_Delete a node in middle of singly linked list_* **_→_** **_[C++](/Chapter%202%20-%20Linked%20Lists/Delete%20Middle%20node/delete_middle_node.cpp)_** **|** **_[Python](/Chapter%202%20-%20Linked%20Lists/Delete%20Middle%20node%20/delete_middle_node.py)_**
* Partition - *_Partition singly linked list around x_* **_→_** **_[C++](/Chapter%202%20-%20Linked%20Lists/Partition/partition.cpp)_** **|** **_[Python](/Chapter%202%20-%20Linked%20Lists/Partition/partition.py)_**
* Intersection - *_Given 2 SLL, check if they intersect_* **_→_** **_[C++](/Chapter%202%20-%20Linked%20Lists/Intersection/Intersection.cpp)_** **|** **_[Python](/Chapter%202%20-%20Linked%20Lists/Intersection/Intersection.py)_**
* Loop Detection - *_Detect loop in Circular Linked List_* **_→_** **_[C++](/Chapter%202%20-%20Linked%20Lists/Loop%20Detection/loop_detection.cpp)_** **|** **_[Python](/Chapter%202%20-%20Linked%20Lists/Loop%20Detection/loop_detection.py)_**
* Sum Lists - *_Add 2 numbers represented by Linked Lists_* **_→_** **_[C++](/Chapter%202%20-%20Linked%20Lists/Sum%20Lists/sum_lists_forward1.cpp)_** **|** **_[Python](/Chapter%202%20-%20Linked%20Lists/Sum%20Lists/sum_lists_backward.py)_**
### Chapter 3:
* Three In One - *_Implement k(3) stacks using single array_* **_→_** **_[C++](/Chapter%203%20-%20Stacks%20and%20Queues/Three%20in%20One/three_in_one.cpp)_** **|** **_[Python](/Chapter%203%20-%20Stacks%20and%20Queues/Three%20in%20One/three_in_one.py)_**
* Stack Min - *_Design min stack that performs push, pop and min in O(1)_* **_→_** **_[C++](/Chapter%203%20-%20Stacks%20and%20Queues/Stacks%20Min/stack_min.cpp)_** **|** **_[Python](/Chapter%203%20-%20Stacks%20and%20Queues/Stack%20Min/stack_min.py)_**
* Stack Of Plates - *_Implement set of stacks with popAt operation_* **_→_** **_[C++](/Chapter%203%20-%20Stacks%20and%20Queues/Stack%20Of%20Plates/stack_of_plates.cpp)_** **|** **_[Python](/Chapter%203%20-%20Stacks%20and%20Queues/Stack%20Of%20Plates/stack_of_plates.py)_**
* Queue Via Stacks - *_Implement queue data structure with 2 stacks_* **_→_** **_[C++](/Chapter%203%20-%20Stacks%20and%20Queues/Queue%20Via%20Stacks/queue_via_stacks.cpp)_** **|** **_[Python](/Chapter%203%20-%20Stacks%20and%20Queues/Queue%20Via%20Stacks/queue_via_stacks.py)_**
* Sort Stacks - *_Sort stack in ascending order using a temporary stack_* **_→_** **_[C++](/Chapter%203%20-%20Stacks%20and%20Queues/Sort%20Stack/sort_stack.cpp)_** **|** **_[Python](/Chapter%203%20-%20Stacks%20and%20Queues/Sort%20Stack/sort_stack.py)_**
* Animal Shelter - *_Design system to allocate animals on FIFO basis from animal shelter_* **_→_** **_[C++](/Chapter%203%20-%20Stacks%20and%20Queues/Animal%20Shelter/animal_shelter.cpp)_** **|** **_[Python](/Chapter%203%20-%20Stacks%20and%20Queues/Animal%20Shelter/animal_shelter.py)_**### Chapter 4:
* Route Between Nodes - *_Check if path exists between two nodes of directed graph_* **_→_** **_[C++](/Chapter%204%20-%20Trees%20and%20Graphs/Route%20Between%20Nodes/route_between_nodes.cpp)_** **|** **_[Python](/Chapter%204%20-%20Trees%20and%20Graphs/Route%20Between%20Nodes/route_between_nodes.py)_**
* List Of Depths - *_Create LinkedList of Nodes at each depth of binary tree_* **_→_** **_[C++](/Chapter%204%20-%20Trees%20and%20Graphs/List%20Of%20Depths/list_of_depths.cpp)_** **|** **_[Python](/Chapter%204%20-%20Trees%20and%20Graphs/List%20Of%20Depths/list_of_depths.py)_**
* Check Balanced - *_Check if Binary Tree is balanced_* **_→_** **_[C++](/Chapter%204%20-%20Trees%20and%20Graphs/Check%20Balanced/check_balanced.cpp)_** **|** **_[Python](/Chapter%204%20-%20Trees%20and%20Graphs/Check%20Balanced/check_balanced.py)_**
* Minimal Tree - *_Construct Binary Search Tree from Sorted Array_* **_→_** **_[C++](/Chapter%204%20-%20Trees%20and%20Graphs/Minimal%20Tree/minimal_tree.cpp)_** **|** **_[Python](/Chapter%204%20-%20Trees%20and%20Graphs/Minimal%20Tree/minimal_tree.py)_**
* Validate BST - *_Check if Binary Tree is Binary Search Tree_* **_→_** **_[C++](/Chapter%204%20-%20Trees%20and%20Graphs/Validate%20BST/validate_bst.cpp)_** **|** **_[Python](/Chapter%204%20-%20Trees%20and%20Graphs/Validate%20BST/validate_bst.py)_**
* First Common Ancestor - *_Find first common ancestor for 2 nodes in Binary Tree_* **_→_** **_[C++](/Chapter%204%20-%20Trees%20and%20Graphs/First%20Common%20Ancestor/first_common_ancestor.cpp)_** **|** **_[Python](/Chapter%204%20-%20Trees%20and%20Graphs/First%20Common%20Ancestor/first_common_ancestor.py)_**### Miscellaneous:
* [Problems](/Miscellaneous/Readme.md) - *_List of relevant problems implemented outside of CTCI_*
## Todo's:
- [ ] Readme per chapter explaining solutions
- [ ] Blog posts per chapter
- [ ] Code refactoring
- [ ] Alternatives to organise readme in better manner