Skip to content

Nitins715/DSA-Solving-Series

Repository files navigation

🧠 DSA Solving Series - Python

This repository contains Python solutions for common Data Structures & Algorithms (DSA) problems, organized week-by-week for structured learning. Each week focuses on a core topic — Arrays, Strings, Hashing, and more — with problems grouped by difficulty level (Easy / Medium / Hard).


📅 Week 1: Arrays & Basic Patterns

🧩 Problem Title 💪 Difficulty
Two Sum 🟢 Easy
Remove Duplicates from Sorted Array 🟢 Easy
Merge Sorted Array 🟢 Easy
Best Time to Buy and Sell Stock 🟢 Easy
Majority Element 🟢 Easy
Contains Duplicate 🟢 Easy
Intersection of Two Arrays II 🟢 Easy
Maximum Subarray 🟡 Medium
Maximum Product Subarray 🟡 Medium
Merge Intervals 🟡 Medium
Next Permutation 🟡 Medium
Container With Most Water 🟡 Medium
Sort Colors 🟡 Medium
Subarray Sum Equals K 🟡 Medium
Product of Array Except Self 🟡 Medium
Find the Duplicate Number 🟡 Medium
Rotate Image 🟡 Medium
Spiral Matrix 🟡 Medium
First Missing Positive 🔴 Hard
Sliding Window Maximum 🔴 Hard

📅 Week 2: Strings & Substrings

🧩 Problem Title 💪 Difficulty
Valid Parentheses 🟢 Easy
Longest Common Prefix 🟢 Easy
Valid Palindrome 🟢 Easy
Find the Index of the First Occurrence in a String 🟢 Easy
Reverse String 🟢 Easy
Valid Anagram 🟢 Easy
Implement strStr() 🟢 Easy
Ransom Note 🟢 Easy
Longest Substring Without Repeating Characters 🟡 Medium
Group Anagrams 🟡 Medium
Longest Palindromic Substring 🟡 Medium
Find All Anagrams in a String 🟡 Medium
String to Integer (atoi) 🟡 Medium
Sort Characters By Frequency 🟡 Medium
Decode String 🟡 Medium
Minimum Remove to Make Valid Parentheses 🟡 Medium
Partition Labels 🟡 Medium
Remove All Adjacent Duplicates in String II 🟡 Medium
Minimum Window Substring 🔴 Hard
Text Justification 🔴 Hard

📅 Week 3: Hashing & HashMaps

🧩 Problem Title 💪 Difficulty
First Unique Character in a String 🟢 Easy
Happy Number 🟢 Easy
Intersection of Two Arrays 🟢 Easy
Word Pattern 🟢 Easy
Contains Duplicate II 🟢 Easy
Isomorphic Strings 🟢 Easy
Two Sum (hash map refresher) 🟢 Easy
Single Number 🟢 Easy
3Sum 🟡 Medium
Top K Frequent Elements 🟡 Medium
Valid Sudoku 🟡 Medium
Group Anagrams (rev) 🟡 Medium
Longest Consecutive Sequence 🟡 Medium
Subarray Sums Divisible by K 🟡 Medium
Find Duplicate Subtrees 🟡 Medium
Find All Duplicates in an Array 🟡 Medium
Random Pick with Weight 🟡 Medium
K-diff Pairs in an Array 🟡 Medium
Max Points on a Line 🔴 Hard
Substring with Concatenation of All Words 🔴 Hard

📅 Week 4: Binary Search & Heaps

🧩 Problem Title 💪 Difficulty
Search Insert Position 🟢 Easy
First Bad Version 🟢 Easy
Sqrt(x) 🟢 Easy
Valid Perfect Square 🟢 Easy
Binary Search 🟢 Easy
Squares of a Sorted Array 🟢 Easy
Peak Index in a Mountain Array 🟢 Easy
Guess Number Higher or Lower 🟢 Easy
Find First and Last Position of Element in Sorted Array 🟡 Medium
Find Peak Element 🟡 Medium
Search in Rotated Sorted Array 🟡 Medium
Search in Rotated Sorted Array II 🟡 Medium
Find Minimum in Rotated Sorted Array 🟡 Medium
Kth Largest Element in an Array 🟡 Medium
Find K Closest Elements 🟡 Medium
Find Kth Smallest Pair Distance 🟡 Medium
Maximum Number of Eaten Apples 🟡 Medium
Time Based Key-Value Store 🟡 Medium
Median of Two Sorted Arrays 🔴 Hard
Find Median from Data Stream 🔴 Hard

📅 Week 5: Linked List

🧩 Problem Title 💪 Difficulty
Reverse Linked List 🟢 Easy
Linked List Cycle 🟢 Easy
Merge Two Sorted Lists 🟢 Easy
Remove Duplicates from Sorted List 🟢 Easy
Middle of the Linked List 🟢 Easy
Palindrome Linked List 🟢 Easy
Delete Node in a Linked List 🟢 Easy
Design Linked List 🟢 Easy
Remove Nth Node From End of List 🟡 Medium
Add Two Numbers 🟡 Medium
Copy List with Random Pointer 🟡 Medium
Odd Even Linked List 🟡 Medium
Add Two Numbers II 🟡 Medium
Remove Duplicates from Sorted List II 🟡 Medium
Swap Nodes in Pairs 🟡 Medium
Rotate List 🟡 Medium
Partition List 🟡 Medium
Reorder List 🟡 Medium
Merge k Sorted Lists 🔴 Hard
Reverse Nodes in k-Group 🔴 Hard

📅 Week 6: Stack & Queues

🧩 Problem Title 💪 Difficulty
Valid Parentheses 🟢 Easy
Implement Queue using Stacks 🟢 Easy
Implement Stack using Queues 🟢 Easy
Min Stack 🟢 Easy
Baseball Game 🟢 Easy
Backspace String Compare 🟢 Easy
Make The String Great 🟢 Easy
Final Prices With a Special Discount in a Shop 🟢 Easy
Daily Temperatures 🟡 Medium
Next Greater Element II 🟡 Medium
Validate Stack Sequences 🟡 Medium
Decode String 🟡 Medium
Evaluate Reverse Polish Notation 🟡 Medium
Sum of Subarray Minimums 🟡 Medium
Asteroid Collision 🟡 Medium
Minimum Add to Make Parentheses Valid 🟡 Medium
Remove K Digits 🟡 Medium
Monotone Increasing Digits 🟡 Medium
Maximal Rectangle 🔴 Hard
Largest Rectangle in Histogram 🔴 Hard

📅 Week 7: Recursion and Backtracking

🧩 Problem Title 💪 Difficulty
Climbing Stairs 🟢 Easy
Pascal's Triangle 🟢 Easy
Pascal's Triangle II 🟢 Easy
Fibonacci Number 🟢 Easy
Letter Case Permutation 🟢 Easy
Subsets (review) 🟢 Easy
Permutations (review) 🟢 Easy
Combinations 🟢 Easy
Combination Sum 🟡 Medium
Combination Sum II 🟡 Medium
Subsets II 🟡 Medium
Generate Parentheses 🟡 Medium
Word Search 🟡 Medium
Permutations II 🟡 Medium
Letter Combinations of a Phone Number 🟡 Medium
Combination Sum III 🟡 Medium
Restore IP Addresses 🟡 Medium
Combination Sum IV 🟡 Medium
N-Queens 🔴 Hard
Sudoku Solver 🔴 Hard

📅 Week 8: Heaps and Priority Queues

🧩 Problem Title 💪 Difficulty
Kth Largest Element in a Stream 🟢 Easy
Last Stone Weight 🟢 Easy
Top K Frequent Words 🟢 Easy
Relative Ranks 🟢 Easy
Find K Pairs with Smallest Sums 🟢 Easy
K Closest Points to Origin 🟢 Easy
Find the Kth Largest Integer in the Array 🟢 Easy
Sort Characters By Frequency (rev) 🟢 Easy
Top K Frequent Elements 🟡 Medium
Kth Largest Element in an Array 🟡 Medium
Task Scheduler 🟡 Medium
Minimum Cost to Connect Sticks 🟡 Medium
IPO 🟡 Medium
Reorganize String 🟡 Medium
Seat Reservation Manager 🟡 Medium
Sort an Array 🟡 Medium
Find K Closest Elements 🟡 Medium
Furthest Building You Can Reach 🟡 Medium
Find Median from Data Stream 🔴 Hard
Smallest Range Covering Elements from K Lists 🔴 Hard

📅 Week 9: Trees (Binary Tree & BST)

🧩 Problem Title 💪 Difficulty
Binary Tree Inorder Traversal 🟢 Easy
Binary Tree Preorder Traversal 🟢 Easy
Binary Tree Postorder Traversal 🟢 Easy
Symmetric Tree 🟢 Easy
Maximum Depth of Binary Tree 🟢 Easy
Same Tree 🟢 Easy
Path Sum 🟢 Easy
Minimum Depth of Binary Tree 🟢 Easy
Binary Tree Level Order Traversal 🟡 Medium
Binary Tree Right Side View 🟡 Medium
Lowest Common Ancestor of a Binary Tree 🟡 Medium
Validate Binary Search Tree 🟡 Medium
Delete Node in a BST 🟡 Medium
Construct Binary Tree from Preorder and Inorder Traversal 🟡 Medium
Construct Binary Tree from Inorder and Postorder Traversal 🟡 Medium
Kth Smallest Element in a BST 🟡 Medium
Binary Tree Zigzag Level Order Traversal 🟡 Medium
Populating Next Right Pointers in Each Node 🟡 Medium
Binary Tree Maximum Path Sum 🔴 Hard
Serialize and Deserialize Binary Tree 🔴 Hard

📅 Week 10: Graphs

🧩 Problem Title 💪 Difficulty
Flood Fill 🟢 Easy
Number of Islands 🟢 Easy
Island Perimeter 🟢 Easy
Max Area of Island 🟢 Easy
Find if Path Exists in Graph 🟢 Easy
Find the Town Judge 🟢 Easy
Rotting Oranges 🟢 Easy
Shortest Path in Binary Matrix 🟢 Easy
Course Schedule 🟡 Medium
Course Schedule II 🟡 Medium
Clone Graph 🟡 Medium
Possible Bipartition 🟡 Medium
Keys and Rooms 🟡 Medium
Number of Provinces 🟡 Medium
Open the Lock 🟡 Medium
Evaluate Division 🟡 Medium
Pacific Atlantic Water Flow 🟡 Medium
Network Delay Time 🟡 Medium
Word Ladder 🔴 Hard
Reconstruct Itinerary 🔴 Hard

📅 Week 11: Dynamic Programming – Part 1

🧩 Problem Title 💪 Difficulty
Climbing Stairs 🟢 Easy
Min Cost Climbing Stairs 🟢 Easy
House Robber 🟢 Easy
Range Sum Query - Immutable 🟢 Easy
Best Time to Buy and Sell Stock 🟢 Easy
Best Time to Buy and Sell Stock II 🟢 Easy
Counting Bits 🟢 Easy
Maximum Subarray 🟢 Easy
Longest Increasing Subsequence 🟡 Medium
Coin Change 🟡 Medium
Combination Sum IV 🟡 Medium
Word Break 🟡 Medium
Target Sum 🟡 Medium
House Robber II 🟡 Medium
Partition Equal Subset Sum 🟡 Medium
Decode Ways 🟡 Medium
Best Time to Buy and Sell Stock with Transaction Fee 🟡 Medium
Maximum Product Subarray 🟡 Medium
Edit Distance 🔴 Hard
Best Time to Buy and Sell Stock IV 🔴 Hard

📅 Week 12: Dynamic Programming – Part 2 (Advanced)

🧩 Problem Title 💪 Difficulty
Fibonacci Number 🟢 Easy
Unique Paths 🟢 Easy
Minimum Path Sum 🟢 Easy
Pascal’s Triangle 🟢 Easy
Pascal’s Triangle II 🟢 Easy
Climbing Stairs 🟢 Easy
Triangle 🟢 Easy
Min Cost Climbing Stairs 🟢 Easy
Interleaving String 🟡 Medium
Maximal Square 🟡 Medium
Palindrome Partitioning II 🟡 Medium
Palindromic Substrings 🟡 Medium
Largest Divisible Subset 🟡 Medium
Word Break II 🟡 Medium
Longest Palindromic Subsequence 🟡 Medium
Unique Paths II 🟡 Medium
Minimum Falling Path Sum 🟡 Medium
Russian Doll Envelopes 🟡 Medium
Distinct Subsequences 🔴 Hard
Dungeon Game 🔴 Hard

✅ Features

  • 🧩 Clean, optimized, and well-documented Python solutions
  • 🧠 Organized week-by-week for focused DSA learning
  • ⚡ In-place and efficient implementations where possible
  • 💬 Each solution includes examples, reasoning, and complexity analysis

🤝 Contribute & Collaborate

You’re welcome to contribute!

  • Add new DSA problems & solutions
  • Improve or optimize existing ones
  • Include insights, comments, or visual explanations

📚 References & Learning Resources

  • LeetCode — Practice platform for problem-solving
  • Classic DSA textbooks & structured pattern-based learning

About

Structured weekly DSA practice in Python — categorized by patterns, topics, and weekly learnings.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages