My working repo for mastering the Two Pointer technique — part of a 90-day DSA patterns study plan. Each problem lives in its own folder with its code and a dedicated README explaining the approach.
two-pointer-dsa/
├── README.md
├── Progress.md
├── notes/
│ └── two_pointer_mastery.md
└── solutions/
├── 01_palindrome_check/
├── 02_two_sum_sorted/
├── 03_longest_palindromic_substring/
├── 04_remove_duplicates/
├── 05_merge_sorted_arrays/
├── 06_linked_list_cycle/
└── 07_middle_of_linked_list/
Each solution folder contains a .py file and its own README.md.
1. Opposite ends (toward each other)
left, right = 0, len(arr) - 1
while left < right:
...
left += 1
right -= 12. Two inputs, exhaust both
i, j = 0, 0
while i < len(a) and j < len(b):
...
result.extend(a[i:]); result.extend(b[j:])3. Fast / slow (same direction)
slow = 0
for fast in range(len(arr)):
if CONDITION:
slow += 1
arr[slow] = arr[fast]| # | Problem | Pattern | Folder |
|---|---|---|---|
| 1 | Valid Palindrome | Opposite ends | 01_palindrome_check/ |
| 2 | Two Sum II (sorted array) | Opposite ends | 02_two_sum_sorted/ |
| 3 | Longest Palindromic Substring | Expand around center | 03_longest_palindromic_substring/ |
| 4 | Remove Duplicates from Sorted Array | Fast/slow | 04_remove_duplicates/ |
| 5 | Merge Sorted Array | Exhaust both | 05_merge_sorted_arrays/ |
| 6 | Linked List Cycle | Fast/slow | 06_linked_list_cycle/ |
| 7 | Middle of Linked List | Fast/slow | 07_middle_of_linked_list/ |
- 3Sum (LeetCode 15)
- Container With Most Water (LeetCode 11)
- Trapping Rain Water (LeetCode 42)
- Move Zeroes (LeetCode 283)
python solutions/01_palindrome_check/palindrome_check.py