Skip to content

NeetCode 150 Coding, documents my journey through the NeetCode 150 problem.

Notifications You must be signed in to change notification settings

yomazini/NeetCode-150-Solutions

Repository files navigation

NeetCode 150 Coding Interview Preparation

🚀 Overview

This repository documents my journey through the NeetCode 150 problem set, designed to comprehensively prepare for technical interviews . Each problem is solved with multiple approaches, focusing on optimal time and space complexity.

🌟 Why This Repository?

  • 🏆 Comprehensive Coverage: Includes all 150 problems categorized by topic.
  • 📂 Well-Organized: Each problem is classified under relevant categories for easy navigation.
  • 🚀 Practical Solutions: Solutions written in C, C++,and Python, and others.
  • 📈 Progress Tracking: Keep tabs on solved problems, My SpreedSheet, (you can copy).
  • 🎯 Targeted Practice: From basic concepts to advanced problems.

📊 Progress Tracker

  • ✅ 🧮 Arrays & Hashing (0/9)
  • ❎ 🔄 Two Pointers (0/5)
  • ❎ 📚 Stack (0/7)
  • ❎ 🚪 Sliding Window (0/6)
  • ❎ 🔍 Binary Search (0/7)
  • ❎ 🔗 Linked List (0/11)
  • ❎ 🌳 Trees (0/15)
  • ❎ 🧵 Tries (0/3)
  • ❎ 🔑 Heap / Priority Queue (0/7)
  • ❎ 🔑 Backtracking (0/9)
  • ❎ 🗺️ Graphs (0/13)
  • ❎ 🌐 Advanced Graphs (0/6)
  • ❎ 🏃 1D Dynamic Programming (0/12)
  • ❎ 🏗️ 2D Dynamic Programming (0/11)
  • ❎ 🏆 Greedy (0/8)
  • ❎ 🕒 Intervals (0/6)
  • ❎ 📐 Math & Geometry (0/8)
  • ❎ 💡 Bit Manipulation (0/7)

🧠 Learning Approach

  1. Problem Understanding: Deeply analyze problem constraints
  2. Multiple Solutions: Implement brute force, optimized, and most optimal solutions
  3. Complexity Analysis: Detailed time and space complexity for each approach
  4. Explanatory Comments: Thorough code commenting explaining logic

🛠 Technologies & Tools

C

C++

Python

LeetCode

Data Structures

💡 Solving Strategy

  • Time Complexity: O(n) or better
  • Space Complexity: O(1) when possible
  • Edge Case Handling: Comprehensive testing
  • Code Readability: Clean, modular solutions

🔍 How to Use This Repository

  1. Clone this repository:
    git clone https://github.com/yomazini/NeetCode-150-Solutions.git
  2. Navigate to the problem category:
    cd Arrays_and_Hashing
  3. Run the solution in your preferred programming language:
    # if Python
    python3 solution.py
    # if C run it with gcc
     gcc main.c 
    # if C++ run it with g
    g++ main.cpp

📚 Resources

📈 Personal Growth

Tracking my learning journey, algorithmic thinking, and problem-solving skills through systematic practice.


📚 Categories & Problems

Below is a categorized list of all the problems. Click on a problem to visit it on LeetCode.

📂 Arrays & Hashing

Problem Link
Contains Duplicate Link
Valid Anagram Link
Two Sum Link
Group Anagrams Link
Top K Frequent Elements Link
Product of Array Except Self Link
Valid Sudoku Link
Encode and Decode Strings Link
Longest Consecutive Sequence Link

📂 Two Pointers

Problem Link
Valid Palindrome Link
Two Sum II Link
3Sum Link
Container with Most Water Link
Trapping Rain Water Link

📂 Sliding Window

Problem Link
Best Time to Buy & Sell Stock Link
Longest Substring Without Repeating Characters Link
Longest Repeating Character Replacement Link
Permutation in String Link
Minimum Window Substring Link

📂 Stack

Problem Link
Valid Parentheses Link
Min Stack Link
Evaluate Reverse Polish Notation Link
Generate Parentheses Link
Daily Temperatures Link
Car Fleet Link
Largest Rectangle in Histogram Link

📂 Binary Search

Problem Link
Binary Search Link
Search a 2D Matrix Link
Koko Eating Bananas Link
Search Rotated Sorted Array Link
Find Minimum in Rotated Sorted Array Link
Time Based Key-Value Store Link
Find Median of Two Sorted Arrays Link

📂 Linked List

Problem Link
Reverse Linked List Link
Merge Two Linked Lists Link
Reorder List Link
Remove Nth Node from End of List Link
Copy List with Random Pointer Link
Add Two Numbers Link
Linked List Cycle Link
Find the Duplicate Number Link
LRU Cache Link
Merge K Sorted Lists Link
Reverse Nodes in K-Group Link

📂 Trees

Problem Link
Invert Binary Tree Link
Maximum Depth of Binary Tree Link
Diameter of a Binary Tree Link
Balanced Binary Tree Link
Same Tree Link
Subtree of Another Tree Link
Lowest Common Ancestor of a BST Link
Binary Tree Level Order Traversal Link
Binary Tree Right Side View Link
Count Good Nodes in a Binary Tree Link
Validate Binary Search Tree Link
Kth Smallest Element in a BST Link
Construct Tree from Preorder and Inorder Traversal Link
Binary Tree Max Path Sum Link
Serialize and Deserialize Binary Tree Link

📂 Tries

Problem Link
Implement Trie Link
Design Add and Search Word Data Structure Link
Word Search II Link

📂 Heap / Priority Queue

Problem Link
Kth Largest Element in a Stream Link
Last Stone Weight Link
K Closest Points to Origin Link
Kth Largest Element in an Array Link
Task Scheduler Link
Design Twitter Link
Find Median from Data Stream Link

📂 Backtracking

Problem Link
Subsets Link
Combination Sum Link
Permutations Link
Subsets II Link
Combination Sum II Link
Word Search Link
Palindrome Partitioning Link
Letter Combinations of a Phone Number Link
N-Queens Link

📂 Graphs

Problem Link
Number of Islands Link
Clone Graph Link
Max Area of Island Link
Pacific Atlantic Waterflow Link
Surrounded Regions Link
Rotting Oranges Link
Walls and Gates Link
Course Schedule Link
Course Schedule II Link
Redundant Connection Link
Number of Connected Components in Graph Link
Graph Valid Tree Link
Word Ladder Link

📂 Advanced Graphs

Problem Link
Reconstruct Itinerary Link
Min Cost to Connect all Points Link
Network Delay Time Link
Swim in Rising Water Link
Alien Dictionary Link
Cheapest Flights with K Stops Link

📂 1-D Dynamic Programming

Problem Link
Climbing Stairs Link
Min Cost Climbing Stairs Link
House Robber Link
House Robber II Link
Longest Palindromic Substring Link
Palindrome Substrings Link
Decode Ways Link
Coin Change Link
Maximum Product Subarray Link
Word Break Link
Longest Increasing Subsequence Link
Partition Equal Subset Sum Link

📂 2-D Dynamic Programming

Problem Link
Unique Paths Link
Longest Common Subsequence Link
Best Time to Buy/Sell Stock With Cooldown Link
Coin Change II Link
Target Sum Link
Interleaving String Link
Longest Increasing Path in a Matrix Link
Distinct Subsequences Link
Edit Distance Link
Burst Balloons Link
Regular Expression Matching Link

📂 Greedy

Problem Link
Maximum Subarray Link
Jump Game Link
Jump Game II Link
Gas Station Link
Hand of Straights Link
Merge Triplets to Form Target Triplet Link
Partition Labels Link
Valid Parenthesis String Link

📂 Intervals

Problem Link
Insert Interval Link
Merge Intervals Link
Non-Overlapping Intervals Link
Meeting Rooms Link
Meeting Rooms II Link
Minimum Interval to Include Each Query Link

📂 Math & Geometry

Problem Link
Rotate Image Link
Spiral Matrix Link
Set Matrix Zeroes Link
Happy Number Link
Plus One Link
Pow(x, n) Link
Multiply Strings Link
Detect Squares Link

📂 Bit Manipulation

Problem Link
Single Number Link
Number of 1 Bits Link
Counting Bits Link
Reverse Bits Link
Missing Number Link
Sum of Two Integers Link
Reverse Integer Link

Disclaimer: Solutions are for learning purposes. Always strive to understand the underlying concepts!

🎭 Author

Made with ☕️ and ☕️☕️☕️ by Youssef Mazini (ymazini)

🤝 Contribution

Open to discussions, alternative solutions, and optimization suggestions. Feel free to open an issue or submit a pull request!

About

NeetCode 150 Coding, documents my journey through the NeetCode 150 problem.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published