Welcome to my repository! This is a comprehensive collection of Data Structures and Algorithms solutions in C++, featuring problems from Striver's SDE Sheet and Striver's A2Z DSA Sheet.
This repository started with a simple goal: complete Striver's SDE Sheet. But as any DSA enthusiast knows, one problem leads to another, one concept branches into ten more, and before you know it, you're deep in the rabbit hole.
What began with the SDE Sheet naturally expanded into the A2Z DSA Sheet - especially when I hit Binary Search and realized I needed to really understand it, not just solve it. The same happened with Trees, Graphs, and Dynamic Programming. Each topic demanded deeper exploration, more problems, more patterns.
So here we are: a comprehensive collection of DSA solutions that maps my entire learning journey. From basic array manipulations to complex graph algorithms, from simple recursion to intricate DP patterns : it's all here.
Whether you're preparing for interviews, competing in contests, or just love the art of problem-solving, I hope this collection serves you as well as creating it has served me.
This repository is organized into topic-based folders, where each folder contains C++ solution files for respective problems.
- Arrays
- Arrays - 1
- Arrays - 2
- Arrays - 3
- Arrays - 4
- Linked Lists
- LinkedList - 1
- LinkedList - 2
- LinkedList and Arrays
- Greedy Algorithms
- Recursion
- Backtracking
- Subsequences Pattern
- Binary Search
- BS on 1D - Arrays
- BS on Answers
- BS on 2D - Arrays
- Stacks & Queues
- Stack and Queue - 1
- Stack and Queue - 2
- Extra Questions
- Trees
- Binary Trees
- Traversals
- Medium Problems
- Hard Problems
- BST or Binary Search Trees
- Binary Trees
- Graphs
- Problems on BFS and DFS
- Shortest Path Algorithms and Problems
- Topological Sort and Problems
- MST and DSU Problems
- Kosaraju's Algo for SCC & Tarjan's Algo for Bridges and Articulation Points
- DP(Dynamic Programming)
- 1D-DP
- 2D-DP, 3D-DP and DP on grids
- Subsequences DP
- DP on Strings
- DP on Stocks
- DP on LIS
- Partition DP
- DP on Squares/Rectangles
- Heaps
- Strings
- Tries
Each solution is named after the problem it solves for easy navigation:
Arrays-1/
├── problem_name.cpp
- template1.cpp - Contest template with fast I/O and common macros
- trees.cpp - Tree problem template with traversal utilities
- Striver's SDE Sheet - Core interview problems covering essential DSA topics
- Striver's A2Z DSA Sheet - Comprehensive topic coverage (Binary Search, Trees, Graphs, DP)
- Clone the repository:
git clone https://github.com/thisisfaizanali/DSA-Problem-Solutions-CPP.git- Navigate to the required topic folder
- Open the
.cppfile to view the solution - Compile and run:
g++ -std=c++17 problem_name.cpp -o solution
./solutionContributions are welcome! Feel free to:
- Suggest optimizations or alternative approaches
- Add more problems from the sheets
- Report issues or bugs
- Improve documentation
If you find this repository helpful for your interview preparation or learning journey, please consider giving it a star ⭐
Happy Coding! 🚀