MTrajK / coding-problems
- четверг, 19 декабря 2019 г. в 00:27:58
Python
Solutions for various coding/algorithmic problems and many useful resources for learning algorithms and data structures
Here you can find solutions for various coding/algorithmic problems and many useful resources for learning algorithms and data structures.
Also, this repo will be updated with new solutions 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:
So, to execute these solutions there is no need from installing any external packages.
Coding style and name conventions are described in this file PEP8.
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.
For easier navigation into the solutions, each file with a solution in this repo will have the following template:
'''
Problem Name
Problem explanation.
Input: XXX
Output: XXX
Output explanation: XXX
=========================================
Solution 1 explanation.
Time Complexity: O(X)
Space Complexity: O(X)
Solution 2 explanation.
(some of the problems are solved in more than one way)
Time Complexity: O(X)
Space Complexity: O(X)
'''
##############
# Solution 1 #
##############
def name_of_solution_1(params):
# description of code
pass
##############
# Solution 2 #
##############
def name_of_solution_2(params):
# description of code
pass
###########
# Testing #
###########
# Test 1
# Correct result => 'result1'
test_val = 'example1'
print(name_of_solution_1(test_val))
print(name_of_solution_2(test_val))
# Test 2
# Correct result => 'result2'
test_val = 'example2'
print(name_of_solution_1(test_val))
print(name_of_solution_2(test_val))Each solution/problem in this repo belongs to one of these categories:
The learning resources are divided into 4 categories: Courses, Books, Training Sites, Other Resources.
Collection of free courses from one of the best CS universities.
Princeton University (Coursera)
MIT University (YouTube)
Harvard University (YouTube)
UC Berkeley
Several books that have made an impression on me:
If the problems from LeetCode are not enough and you need more problems like those, you can find much more on these platforms: