Skip to content

Latest commit

 

History

History
189 lines (141 loc) · 6.19 KB

File metadata and controls

189 lines (141 loc) · 6.19 KB

NeetCode & LeetCode Solutions

A well-organized collection of solutions for NeetCode 150 and LeetCode problems covering all major Data Structures & Algorithms topics. All solutions are written in C++ with detailed explanations, complexity analysis, and example test cases.


📂 Directory Structure

.
├── Arrays_and_Hashing/
├── Two_Pointers/
├── Sliding_Window/
├── Stack/
├── Binary_Search/
├── Linked_List/
├── Trees/
├── Tries/
├── Heap_Priority_Queue/
├── Backtracking/
├── Graphs/
├── Dynamic_Programming/
├── Greedy/
├── Intervals/
├── Math_and_Geometry/
└── Bit_Manipulation/

📋 Problem Index

🗂️ Arrays & Hashing

# Title Difficulty
1 Two Sum Easy
49 Group Anagrams Medium
128 Longest Consecutive Sequence Medium
217 Contains Duplicate Easy
238 Product of Array Except Self Medium
242 Valid Anagram Easy
347 Top K Frequent Elements Medium

👆 Two Pointers

# Title Difficulty
11 Container With Most Water Medium
15 3Sum Medium
125 Valid Palindrome Easy
167 Two Sum II Medium

🪟 Sliding Window

# Title Difficulty
3 Longest Substring Without Repeating Characters Medium
121 Best Time to Buy and Sell Stock Easy
424 Longest Repeating Character Replacement Medium

📚 Stack

# Title Difficulty
20 Valid Parentheses Easy
155 Min Stack Medium
739 Daily Temperatures Medium

🔍 Binary Search

# Title Difficulty
33 Search in Rotated Sorted Array Medium
153 Find Minimum in Rotated Sorted Array Medium
704 Binary Search Easy

🔗 Linked List

# Title Difficulty
21 Merge Two Sorted Lists Easy
141 Linked List Cycle Easy
206 Reverse Linked List Easy

🌳 Trees

# Title Difficulty
100 Same Tree Easy
104 Maximum Depth of Binary Tree Easy
226 Invert Binary Tree Easy
235 Lowest Common Ancestor of BST Medium

🌲 Tries

# Title Difficulty
208 Implement Trie (Prefix Tree) Medium

🏔️ Heap / Priority Queue

# Title Difficulty
215 Kth Largest Element in an Array Medium
295 Find Median from Data Stream Hard

🔄 Backtracking

# Title Difficulty
39 Combination Sum Medium
78 Subsets Medium

🕸️ Graphs

# Title Difficulty
133 Clone Graph Medium
200 Number of Islands Medium

💡 Dynamic Programming

# Title Difficulty
70 Climbing Stairs Easy
198 House Robber Medium
300 Longest Increasing Subsequence Medium
322 Coin Change Medium

💰 Greedy

# Title Difficulty
53 Maximum Subarray Medium
55 Jump Game Medium

📅 Intervals

# Title Difficulty
56 Merge Intervals Medium
57 Insert Interval Medium

🔢 Math & Geometry

# Title Difficulty
48 Rotate Image Medium
50 Pow(x, n) Medium

⚡ Bit Manipulation

# Title Difficulty
191 Number of 1 Bits Easy
338 Counting Bits Easy

🚀 How to Run

Each solution file is standalone and can be compiled and executed:

g++ -std=c++17 Arrays_and_Hashing/1_two_sum.cpp -o solution
./solution

📊 Solution Format

Every solution file includes:

  • Problem statement with examples and constraints
  • Approach explanation in comments
  • Time & Space Complexity analysis
  • Clean C++ implementation
  • Runnable test cases in the main() function

🏷️ Difficulty Legend

Badge Meaning
Easy Foundational problems
Medium Core DSA patterns
Hard Advanced techniques