GithubHelp home page GithubHelp logo

developeramarish / coding-problems Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mtrajk/coding-problems

0.0 0.0 0.0 194 KB

Solutions for various coding/algorithmic problems and many useful resources for learning algorithms and data structures

License: MIT License

Python 100.00%

coding-problems's Introduction

Coding Problems

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.

Solutions

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.

Template

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))

Categories

Each solution/problem in this repo belongs to one of these categories:

  1. Arrays - Array Manipulations, Sorting, Binary Search, Divide and Conquer, Sliding Window, etc.
  2. Linked Lists - Linked List Searching, Pointer Manipulations, etc.
  3. Trees - Binary Search Trees, Tree Traversals: Breadth-First (Level Order) Traversal, Depth-First Traversal (Inorder, Preorder, Postorder), etc.
  4. Dynamic Programming - 2D and 1D Dynamic Programming, LCS, LIS, Knapsack, etc.
  5. Strings - String Manipulations, Reversing, Encodings/Decodings, etc.
  6. Math - GCD, LCM, Factorization, Geometry, Math Formulas, etc.
  7. Other - Backtracking, BFS, DFS, Queues, Stacks, Matrices, etc.

Learning Resources

The learning resources are divided into 4 categories: Courses, Books, Training Sites, Other Resources.

Courses

Collection of free courses from one of the best CS universities.

  1. Standford University (Coursera)

  2. Princeton University (Coursera)

  3. UC San Diego (Coursera)

  4. MIT University (YouTube)

  5. Harvard University (YouTube)

  6. UC Berkeley

Books

Several books that have made an impression on me:

  1. Grokking Algorithms by Aditya Bhargava - The best book for complete beginners in algorithms! I wish this book existed when I started learning algorithms.
  2. Introduction to Algorithms by CLRS - This book is called "bible textbook of algorithms" by many programmers.
  3. Algorithms by Robert Sedgewick & Kevin Wayne - These authors are instructors of the previously mentioned coursera courses: Algorithms Part 1 and Algorithms Part 2. Also this book has excellent and free site with exercises, presentations, and examples.
  4. The Algorithm Design Manual by Steven Skiena - The book describes many advanced topics and algorithms and it focuses on real life practical examples. This book has one of the best site with resources (solutions, algorithms and data structures, python implementations).
  5. Algorithms by S. Dasgupta, C. Papadimitriou, and U. Vazirani - This book is an official book for algorithm and data structure classes in several famous universities.
  6. Competitive Programming 3 by Steven Halim & Felix Halim - A great book that prepares you for competitive programming (not for complete beginners). You can learn many things and tricks about competitive programming.

Training Sites

If the problems from LeetCode are not enough and you need more problems like those, you can find much more on these platforms:

Other Resources

  1. Geeks For Geeks - The site which all interested in algorithms (no matter if beginners or experts) should know!
  2. The Algorithms - Python - Great GitHub repo with many algorithms written in Python (Link from the same repo written in other programming languages).
  3. CP Algorithms - Great page with excellent explanations for various algorithms.
  4. KhanAcademy - Algorithms - Good explanations for some basic algorithms.
  5. HackerRank - YouTube tutorials

coding-problems's People

Contributors

philippeitis avatar pkacprzak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.