Skip to content

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

License

Notifications You must be signed in to change notification settings

sagarneeli/coding-challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Problems

Here you can find notebooks with 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

Notebooks 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.

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

Notebook Structure

Source

  • Eg Leetcode, Geeksforgeeks etc

Problem Statement

  • States the problem to solve.
  • Input parameters
  • Output result

Constraints

  • Describes any constraints or assumptions.

Test Cases

  • Describes the general and edge test cases that will be evaluated in the unit test.

Algorithm and notes

  • Describes the pattern and technique used to solve the problem.

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. Hashing DS - Hashing Data Structures: Sets/HashSets and Dictionaries/HashMaps.
  5. Dynamic Programming - 2D and 1D Dynamic Programming, LCS, LIS, Knapsack, etc.
  6. Strings - String Manipulations, Reversing, Encodings/Decodings, etc.
  7. Math - GCD, LCM, Factorization, Geometry, Math Formulas, etc.
  8. Other - Backtracking, BFS, DFS, Stacks, Queues, Deques, Priority Queues (Heaps), Matrices, etc.

Repo Structure

coding-challenges             # Repo
├─ Arrays                     # Category of challenges
│  ├─ rotation.ipynb          # Solution notebook
│  ├─ compress_solution.ipynb
│  ├─ ...
├─ linked_lists
│  ├─ palindrome
│  ├─ ...
├─ ...

Notebook Installation

Jupyter Notebook

Run:

pip install jupyter

For more details on notebook installation, follow the directions here.

More information on IPython/Jupyter Notebooks can be found here.

Running Challenges

$ git clone https://github.com/sagarneeli/coding-challenges.git
$ cd interactive-coding-challenges
$ jupyter notebook

Contact Info

Feel free to contact me to discuss any issues, questions, or comments.

My contact info can be found on my GitHub page.

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! YouTube channel with many useful videos.
  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. 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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages