Skip to content

Comprehensive collection of DSA solutions in C++ from Striver's SDE Sheet and A2Z DSA Sheet - covering Arrays, Trees, Graphs, DP, and more

Notifications You must be signed in to change notification settings

thisisfaizanali/DSA-Problem-Solutions-CPP

Repository files navigation

DSA Problem Solutions - C++

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.

📖 About This Repository

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.

📂 Repository Structure

This repository is organized into topic-based folders, where each folder contains C++ solution files for respective problems.

✅ Completed Topics:

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

🚧 Pending Topics:

  • Heaps
  • Strings
  • Tries

📑 File Naming Convention

Each solution is named after the problem it solves for easy navigation:

Arrays-1/
├── problem_name.cpp

📜 Templates

  • template1.cpp - Contest template with fast I/O and common macros
  • trees.cpp - Tree problem template with traversal utilities

🎯 Problem Sources

  • Striver's SDE Sheet - Core interview problems covering essential DSA topics
  • Striver's A2Z DSA Sheet - Comprehensive topic coverage (Binary Search, Trees, Graphs, DP)

🔧 How to Use

  1. Clone the repository:
git clone https://github.com/thisisfaizanali/DSA-Problem-Solutions-CPP.git
  1. Navigate to the required topic folder
  2. Open the .cpp file to view the solution
  3. Compile and run:
g++ -std=c++17 problem_name.cpp -o solution
./solution

💡 Contributions

Contributions are welcome! Feel free to:

  • Suggest optimizations or alternative approaches
  • Add more problems from the sheets
  • Report issues or bugs
  • Improve documentation

⭐ Support

If you find this repository helpful for your interview preparation or learning journey, please consider giving it a star ⭐


Happy Coding! 🚀

About

Comprehensive collection of DSA solutions in C++ from Striver's SDE Sheet and A2Z DSA Sheet - covering Arrays, Trees, Graphs, DP, and more

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages