Here you can find solutions for various challenges that focus on algorithms and data structures found in coding interviews.
Each challenge has one or more reference solutions that are:
- Fully functional
- Unit tested
- Easy-to-understand
Solutions also detail:
- Constraints
- Test cases
- Algorithms
- Big-O time and space complexities
Also, this repo will be updated with new solutions and resources from time to time.
Note that this repo is meant to be used for learning and researching purposes only and it is not meant to be used for production.
All solutions are written in Python (more precisely, Python 3), using the Built-in Functions (print, len, range, sorted, sum, min, max, etc...) and a few modules from the Python Standard Library like:
- math (used for constants like math.pi, math.inf and functions like math.ceil, math.floor, math.gcd, math.log, math.pow, math.sqrt, etc)
- collections (used for collections.deque when there is a need for Stack or Queue data structures)
- heapq (used when there is a need for Priority Queue data structure).
- random (used for nondeterministic algorithms, like shuffling arrays (Fisher–Yates shuffle), sampling arrays (Reservoir sampling) and Monte Carlo methods).
So, to execute these solutions there is no need from installing any external packages.
Coding style and name conventions are described in the official PEP8 page.
Note that I'm not the author of these problems, they are from sites like LeetCode (you can find more than 40 sites like this in the Training Sites section). Only the solutions and explanations are mine.
Feel free to contact me to discuss any issues, questions, or comments.
My contact info can be found on my GitHub page.
If the problems from LeetCode are not enough and you need more problems like those, you can find much more on these platforms:
- HackerRank
- CodeChef
- HackerEarth
- CodeForces
- Topcoder
- Project Euler
- SPOJ
- A2OJ
- PEG
- Online Judge
- E-Olymp
- VJudge
- DMOJ
- USA CO
- Rosetta Code
- AtCoder
- Russian Code Cup
- LintCode
- Kattis
- CodeAbbey
- CS Academy
- Advent of Code
- Exercism
- CodeFu
- Mendo
- Z-Training
- Codewars
- Wolfram Challenges
- Google's Coding Competitions
- Cyber-dojo
- CodingBat
- CodeKata
- BinarySearch
- Daily Coding Problem
- Daily Interview Pro
- AlgoDaily
- Codility
- CoderByte
- AlgoExpert
- Edabit
- DevPost
- Brilliant
- Codingame
- CheckiO
- FightCode
- Kaggle
- Rosalind
- Geeks For Geeks - The site which all interested in algorithms (no matter if beginners or experts) should know! YouTube channel with many useful videos.
- The Algorithms - Python - Great GitHub repo with many algorithms written in Python (Link from the same repo written in other programming languages).
- CP Algorithms - Great page with excellent explanations for various algorithms.
- Visualizers:
- USFCA Visualization Tool - Great tool for visualizing data structures and algorithms, created by the University of San Francisco.
- VisuAlgo - Another great tool for visualizing data structures and algorithms through animation.
- Algorithm Visualizer - Interactive online platform that visualizes algorithms from code. This platform is an open-source project, here you can find the source code.