Skip to content

datawithusman/leetcode-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Solutions

My solutions to LeetCode problems in Python, organized by pattern.

Progress

Difficulty Solved
Easy 25
Medium 30
Hard 5
Total 60

By Topic

Arrays & Hashing

# Problem Difficulty Solution
1 Two Sum Easy Python
217 Contains Duplicate Easy Python
49 Group Anagrams Medium Python
347 Top K Frequent Elements Medium Python
238 Product of Array Except Self Medium Python

Two Pointers

# Problem Difficulty Solution
125 Valid Palindrome Easy Python
15 3Sum Medium Python
11 Container With Most Water Medium Python

Sliding Window

# Problem Difficulty Solution
121 Best Time to Buy/Sell Stock Easy Python
3 Longest Substring Without Repeating Medium Python

Binary Search

# Problem Difficulty Solution
704 Binary Search Easy Python
33 Search in Rotated Sorted Array Medium Python

Linked List

# Problem Difficulty Solution
206 Reverse Linked List Easy Python
21 Merge Two Sorted Lists Easy Python
141 Linked List Cycle Easy Python

Trees

# Problem Difficulty Solution
226 Invert Binary Tree Easy Python
104 Maximum Depth of Binary Tree Easy Python
102 Level Order Traversal Medium Python
98 Validate BST Medium Python

Heap / Priority Queue

# Problem Difficulty Solution
703 Kth Largest in Stream Easy Python
215 Kth Largest in Array Medium Python

Graphs

# Problem Difficulty Solution
200 Number of Islands Medium Python
133 Clone Graph Medium Python
207 Course Schedule Medium Python

Dynamic Programming

# Problem Difficulty Solution
70 Climbing Stairs Easy Python
198 House Robber Medium Python
322 Coin Change Medium Python

How I Solve

  1. Understand — Read 3 times, write examples by hand
  2. Brute Force — Get something working, even O(n²)
  3. Optimize — Identify the pattern, reduce complexity
  4. Code — Clean solution with comments on approach
  5. Test — Edge cases: empty, single element, negatives

Patterns I Focus On

Pattern Key Insight
Two Pointers Start from both ends, move inward
Sliding Window Expand/contract window, track state
Binary Search Find search space, eliminate half
BFS/DFS Queue for shortest, stack for exhaustion
Top-K Elements Heap of size K
DP Memoization → tabulation
Backtracking Choose → explore → un-choose

About

22 LeetCode solutions in Python — arrays, DP, graphs, trees, linked lists, two pointers, sliding window.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages