Data Structures
Arrays, Strings, Sliding Window, Two Pointers, Searching & Binary Search, Sorting, Linked List, Stack & Queue, Recursion & Backtracking, Trees, Heap / Priority Queue, Graphs, Dynamic Programming, Greedy, Bit Manipulation, Trie, Math & Number Theory, Design (LLD / OOP), SQL, System Design (HLD)
180 notes in 20 topics
Topics in Data Structures
Notes
Two Sum II - Input Array Is Sorted
Learn how to solve Two Sum II (Input Array Is Sorted) using the two pointer technique in O(n) time and O(1) space, with a clear walkthrough and Python...
Valid Palindrome (Two Pointer Check)
Check if a string is a valid palindrome using two pointers, ignoring case and non-alphanumeric characters, in O(n) time and O(1) space.
Reverse Vowels of a String
Reverse only the vowels of a string in place using two pointers, in O(n) time.
Remove Element In Place
Remove all occurrences of a value from an array in place using the slow/fast two pointer pattern, returning the new length in O(n).
Move Zeroes Using Two Pointers
Move all zeroes to the end of an array while keeping the order of non-zero elements, using two pointers in O(n) time and O(1) space.
3Sum Closest
Find the sum of three integers closest to a target using sorting plus the two pointer technique, in O(n^2) time.
4Sum
Find all unique quadruplets that sum to a target using sorting, nested loops, and two pointers, in O(n^3) time.
Sort Array By Parity
Rearrange an array so even numbers come before odd numbers using two pointers, in place in O(n) time.