Unique Paths II
count paths from top-left to bottom-right with obstacles using dp with space optimization to O(n).
Leetcode
I collated all the leetcode problems i solved in here so you can learn from it
count paths from top-left to bottom-right with obstacles using dp with space optimization to O(n).
notes and solution files for walking robot simulation.
rearrange array in wiggle pattern (nums[0] < nums[1] > nums[2] < ...) using sorted interleaving.
find the largest plus sign order by computing longest consecutive 1s in four directions using dp.
notes and solution files for movie rating.
notes and solution files for game theory.
find minimum balls needed to clear board using dfs with memoization, trying to form groups of 3+.
distribute candy to children based on ratings using two-pass greedy approach.
find maximum number of points that lie on the same line using slope calculation and hash map.
implement RecentCounter using circular queue to count requests within last 3000ms.
find the largest palindrome made from the product of two n-digit numbers using brute force with optimizations.
find the largest square of 1s in a binary matrix using dynamic programming.
build balanced bst from sorted array by recursively using middle element as root.
find minimum largest sum when splitting array into k subarrays using binary search on answer.
notes and solution files for special array i.
implement least frequently used cache with O(1) operations using hash maps and doubly linked lists.
find shortest transformation sequence from beginWord to endWord using bfs.
notes and solution files for maximum xor with an element from array.
binary search on a sorted 2d matrix by treating it as a flattened sorted array.
find all pairs of words that form palindrome when concatenated by checking all prefix/suffix splits.
find median for each sliding window using sorted list to maintain window in sorted order.
rearrange array so no element equals the average of its neighbors using sorted interleaving pattern.
validate if string represents a valid number using state machine or regex.
notes and solution files for reshape data pivot.
notes and solution files for reshape data melt.
notes and solution files for reshape data concatenate.
set entire row and column to zero when element is zero, using first row and column as markers for O(1) space.
notes and solution files for kth smallest in lexicographical order.
notes and solution files for palindrome partitioning ii.
check if a grid can be fully covered by stamps using prefix sums and 2d difference array.
count total number of digit 1 appearing in all numbers from 1 to n using digit dp or mathematical analysis.
find minimum steps to make password strong by handling length, character types, and repeating sequences.
notes and solution files for 1 bit and 2 bit characters.
notes and solution files for asteroid collission.
notes and solution files for change data type.
notes and solution files for dota2 senate.
notes and solution files for drop duplicate rows.
notes and solution files for drop missing data.
notes and solution files for equal row and column pairs.
notes and solution files for fill missing data.
notes and solution files for modify columns.
notes and solution files for removing stars from a string.
notes and solution files for rename columns.
find all shortest transformation sequences from beginWord to endWord using bfs with path tracking.
notes and solution files for insertion sort list.
Sliding a fixed hourglass mask through the grid and tracking the best sum with constant-time updates.
Binary search on the side length of the square holes while counting rails removed along each axis.
compress string in-place by replacing consecutive characters with character and count using two pointers.
notes and solution files for select data.
check if rectangles form exact rectangle without gaps or overlaps using corner counting and area validation.
Check every 3×3 window for the 1..9 magic square pattern using center and parity pruning.
notes and solution files for largest magic square.
determine if a frog can cross a river using dfs with memoization, tracking position and last jump distance.
match string against pattern with . and * using dynamic programming with memoization.
check if there exist two indices with value difference ≤ valueDiff and index difference ≤ indexDiff using sliding window with sorted array.
3sum
add two numbers
all oone data structure
arithmetic slices ii subsequence
basic calculator
burst balloons
combination sum
container with most water
count of smaller numbers after self
critical connections in a network
data stream as disjoint intervals
expression add operators
find first and last position of element in sorted array
find median from data stream
generate parentheses
group anagrams
insert delete getrandom o1 duplicates allowed
integer to english words
overview of my leetcode writeups and plan
letter combinations of a phone number
longest increasing path in a matrix
longest palindromic substring
longest substring without repeating characters
max sum of rectangle no larger than k
maximum subarray
median of two sorted arrays
merge k sorted lists
merge two sorted lists
48 my leetcode journey
next permutation
patching array
permutations
read n characters given read4 ii call multiple times
reconstruct itinerary
remove invalid parentheses
remove nth node from end of list
rotate image
search in rotated sorted array
self crossing
serialize and deserialize binary tree
shortest palindrome
skyline problem
sliding window maximum
18 solving leetcode problems part2
17 solving leetcode problems
trapping rain water
trips and users
valid parentheses
notes and solution files for dungeon game.
notes and solution files for minimum window substring.
count pairs where nums[i] > 2 * nums[j] and i < j using merge sort with counting during merge phase.
notes and solution files for count artifacts that can be extracted.
notes and solution files for get the size of a dataframe.
design a service to compute sums of adjacent and diagonal neighbors using prefix sums and linear search.
notes and solution files for find minimum in rotated sorted array ii.
count subarrays with sum in range [lower, upper] using prefix sums and merge sort counting.
find minimum sum path from top-left to bottom-right using dynamic programming with space optimization.
notes and solution files for sort list.
match string against pattern with ? and * using dynamic programming.
coordinate hydrogen and oxygen threads to form water molecules using semaphores and barrier synchronization.
notes and solution files for create a dataframe from list.
find two indices whose values sum to target using hash map for O(n) lookup.
find the smallest missing positive integer using array as hash table by placing each number at its correct index.
calculate trapped rainwater in 2d elevation map using min heap starting from boundary cells.
notes and solution files for poor pigs.
notes and solution files for sort colors.
notes and solution files for method chaining.
notes and solution files for matrix block sum.
notes and solution files for palindrome number.
notes and solution files for root equals sum of children.
find maximum number of envelopes that can be nested using longest increasing subsequence on sorted envelopes.
normalize unix-style file paths by handling . and .. components using a stack.
notes and solution files for display the first three rows.