Welcome to the Data Structures & Algorithms Optimized Problem Collection!
This repository houses my personal structured and curated collection of the most relevant DSA problems, extracted from reputable sources like LeetCode, HackerRank, Elements of Programming Interviews...
Many people do more than 500 coding questions to prepare for coding interviews. It is NOT NECESSARY to do this. After reviewing many different sources (LeetCode, HackerRank, GeeksforGeeks, Elements of Programming Interviews...) I have put together a curated selection of the ~100 most relevant DSA problems and their solutions, organized by fields
, sub-fields
, classes
of problems and difficulty
levels.
This collection aims to simplify the learning curve to prepare for DSA coding interviews, by providing a structured and optimized selection of 5-10 problems for each DSA category that will help understand the "general type" of questions, focusing only on the 20% of problems that matter the most and reducing workload by 80%.
There are plenty of "Best lists" for DSA that can be found online (see resources below). The purpose of this repository is not to be the "ultimate" collection of DSA problems. I decided to create this collection to better understand the field of DSA while I was preparing for coding interviews, and help others do the same for free. It includes problems that I've come across and I've found most relevant from my personal point of view. At the same time, it's organized following a structure I personally find intuitive and practical for the global understanding of Data Structures and Algorithms, but it doesn't intend to be a 100% unique representation of reality.
With that being said, and although this collection is designed based on my personal understanding of the subject, I'm more than happy to receive feedback, suggestions and improvements that can help the community in any way!
- Curated Selection: I've handpicked the most relevant problems to ensure you focus your time and effort on mastering essential concepts.
- Optimized Learning: The collection is designed with the 80/20 principle in mind: focusing on achieving 80% of the learning with just 20% of the effort, saving you valuable time and energy.
- Structured Learning Path: The collection follows a progressive learning path, guiding you through increasingly challenging problems to build your skills step by step.
- Versatile Content: Whether you're a beginner starting your DSA journey or an experienced programmer looking to sharpen your skills, I believe this collection can be helpful for you in some way.
DSA problems are classified into fields
, sub-fields
, classes
of problems and difficulty
levels.
DSA problems are classified into 5 fields
, with its own sub-fields
:
-
Abstract Data Types
- Numerical Types (& Math)
- Sequences I - Bits & Bytes
- Sequences II - Strings
- Sequences III - Lists, Stacks & Queues
- Sets & Maps
-
Data Structures
- Arrays
- Linked Lists
- Hash-Maps
- Trees
- Trees by Nº of Nodes:
- Tree (any nº of nodes)
- Binary Tree (2 nodes)
- Trees by Type of Sorting:
- Search Tree (horizontally sorted tree)
- Heap (vertically sorted tree)
- Trees by Nº of Nodes:
- Graphs
-
Algorithms
- Programming Strategy Algorithms
- Search Algorithms
- Sorting Algorithms
- Graphs Algorithms
- Optimization Algorithms
- Other Algorithms
-
Systems Design (still work in progress)
-
Coding Interview Problems
Within each sub-field, problems are classified according to 4 main classes
, which encompass different objectives and difficulty
levels:
- Foundational Problems Aim to provide a general introduction to the sub-field, and present the basic operations and functionalities in the form of short and to-the-point exercises. Foundational problems are not usually asked in practical coding interviews, but can be asked sometimes as part of "theoretical understanding" of a specific data-type or data-structure. In this repository, foundational problems are only introduced for Python at the moment, but some other languages (JAVA, C++) may be added in the future.
- Easy Problems Easy problems include practical questions that involve using the properties/advantages of the sub-field of study. They're ideal to tackle right after the foundational problems to strengthen the understanding of the DSA sub-field. Easy problems are commonly asked as introductory questions in early/middle round coding interviews, and should take between 5-20 min to complete.
- Medium Problems Medium problems are challenging problems that already require a decent level of skill using a specific DSA sub-field. They usually involve using a specific type of algorithm that works well for a particular set of problems. Medium problems are typically the ones that you can expect as "main question" in most coding interviews. They typically take between 15-40 min to solve for the first time.
- Hard Problems Hard problems are very challenging (and tricky) problems that require not only a good mastery of the specific DSA sub-field, but also good knowledge and skills with algorithms and most importantly: good coding intuition. Most of the hard problems require realizing a certain trick or alternative formulation that makes the question easier to solve. Hard problems are asked in coding interviews mainly oriented to heavy software-developer roles, or certain positions in finance that require strong problem-solving skills. Depending on the coding expertise, hard problems can take from 15 minutes to several hours to solve; although is common to give up before finding a solution. For time optimization purposes, it's recommended to look at the answer to hard problems if no meaningful progress towards the solution has been made after 30-40 minutes.
All the problems presented in the collection include solutions. The main programming languages of the solutions are Python, JAVA and C++:
- Solutions for the foundational problems are available only in Python at the moment.
- Solutions for all the problems (easy, medium and hard) are usually available in Python, JAVA and C++ (except a few cases where only Python is available).
Solutions for the problems are not all my own, but usually a combination of my personal implementation and the best solutions I've found for each problem. I've made an effort to reference the original source of the answer for those problems/solutions that are not my own, but feedback is appreciated if this is not the case for some problems.
- Explore Categories: Browse through the organized categories to find problems that align with your interests and skill level.
- Challenge Yourself: Dive into the problems, solve them, and test your understanding of key DSA concepts.
- Track Your Progress: Keep track of your progress as you tackle each problem, and celebrate your achievements along the way.
Contributions from the community to enhance and improve the problem collection are more than welcome! If you have suggestions for additional problems, improvements to existing ones, or any other feedback, please feel free to contribute!
- 🥇 Data Structures and Algorithms Made Easy
- 🥈 Elements of Programming Interviews
- 🥉 Cracking the Coding Interview
- Grokking Algorithms
- CLRS - Introduction to Algorithms
- 🥇 LeetCode
- 🥈 HackerRank
- 🥉 Interview Bit
- Coderbyte
- Techie Delight
- Codewars
- CodeChef
- CodingNinjas
- TopCoder
- Geektastic
- HackerEarth
Ready to embark on your journey to DSA mastery? Explore the collection, challenge yourself with the problems, and let's take your programming skills to new heights together!
Happy coding! 🚀