arrays_strings | ||
images | ||
linked_lists | ||
online_judges | ||
recursion_dynamic | ||
sorting_searching | ||
stacks_queues | ||
templates | ||
__init__.py | ||
.gitignore | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md |
interactive-coding-challenges
Interactive, test-driven coding challenges.
Challenges focus on algorithms and data structures that are typically found in coding interviews or coding competitions.
Each challenge has one or more reference solutions that are:
- Fully functional
- Unit tested
- Easy-to-understand
Notebooks also detail:
- Constraints
- Test cases
- Algorithms
- Big-O time and space complexities
Index
- Arrays and Strings
- Linked Lists
- Stacks and Queues
- Sorting and Searching
- Recursion and Dynamic Programming
- Trees and Graphs
- Bit Manipulation
- Scalability and Memory Limits
- Concurrency
- Online Judges
- Notebook Installation
- Credits
- Contributing
- Contact Info
- License
Arrays and Strings
Notebook | Problem Statement |
---|---|
unique_chars | Determine if a string contains unique characters |
reverse_string | Reverse characters in a string |
permutation | Determine if a string is a permutation of another |
compress | Compress a string |
rotation | Determine if a string is a rotation of another |
hash-map | Implement a hash table with set, get, and remove methods |
Linked Lists
Notebook | Problem Statement |
---|---|
remove_duplicates | Remove duplicates from a linked list |
kth_to_last_elem | Find the kth to last element of a linked list |
delete_mid | Delete a node in the middle of a linked list, given access to only that node |
partition | Partition a linked list around a given value |
add_reverse | Add two numbers whose digits are stored in a linked list in reverse order |
find_loop_start | Find the start of a linked list loop |
palindrome | Determine if a linked list is a palindrome |
linked_list | Implement a linked list with insert, find, delete, and print methods |
Stacks and Queues
Notebook | Problem Statement |
---|---|
n_stacks | Implement n stacks using a single array |
stack_min | Implement a stack that keeps track of its minimum element |
set_of_stacks | Implement a set of stacks class that wraps a list of stacks, each bound by a capacity |
hanoi | Implement the Towers of Hanoi with 3 towers and N disks |
queue_from_stacks | Implement a queue using two stacks |
sort_stack | Sort a stack using another stack as a buffer |
stack | Implement a stack with push, pop, and peek methods using a linked list |
queue | Implement a queue with enqueue and dequeue methods using a linked list |
Sorting and Searching
Notebook | Problem Statement |
---|---|
selection_sort | Implement selection sort |
insertion_sort | Implement insertion sort |
quick_sort | Implement quick sort |
merge_sort | Implement merge sort |
Recursion and Dynamic Programming
Notebook | Problem Statement |
---|---|
fibonacci | Implement fibonacci recursively, dynamically, and iteratively |
Trees and Graphs
[Coming Soon]
Bit Manipulation
[Coming Soon]
Scalability and Memory Limits
[Coming Soon]
Concurrency
[Coming Soon]
Online Judges
Notebook | Problem Statement |
---|---|
utopian_tree | View problem statement on HackerRank |
maximizing_xor | View problem statement on HackerRank |
Notebook Installation
If you already have Python installed and are familiar with installing packages, you can get IPython with pip:
pip install ipython
Or if you want to also get the dependencies for the IPython notebook:
pip install "ipython[notebook]"
For more details on installation, follow the directions here.
To interact with or to modify elements within the IPython notebooks, you must first clone or download the repository then run the ipython notebook. More information on IPython Notebooks can be found here.
$ git clone https://github.com/donnemartin/interactive-coding-challenges.git
$ cd [downloaded repo directory name]
$ ipython notebook
Notebook tested with Python 2.7.x.
Credits
- Cracking the Coding Interview | GitHub
- Elements of Programming Interviews | GitHub
- Programming Interviews Exposed
- The Algorithm Design Manual | Selected Solutions
- CareerCup
- Quora
- HackerRank
- TopCoder
Contributing
Contributions are welcome!
For bug reports or requests please submit an issue.
For pull requests, please follow the general notebook format.
Contact Info
Feel free to contact me to discuss any issues, questions, or comments.
- Email: donne.martin@gmail.com
- Twitter: @donne_martin
- GitHub: donnemartin
- LinkedIn: donnemartin
- Website: donnemartin.com
License
Copyright 2015 Donne Martin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.