↓Skip to main content

LeetCode

LeetCode 2264: Largest 3-Same-Digit Number in String
·1 min
LeetCode Easy String
LeetCode 2264 note: there are only ten candidates, “000” to “999”, so check from “999” down whether each appears
LeetCode 901: Online Stock Span
·2 mins
LeetCode Daily Medium Stack Monotonic-Stack Data-Structures Design Design-Patterns Stock
Solving the Online Stock Span problem using monotonic stack approach
LeetCode 853: Car Fleet
·2 mins
LeetCode Daily Medium Array Stack Greedy Simulation Sorting
Solving the Car Fleet problem using stack-based approach
LeetCode 84: Largest Rectangle in Histogram
·3 mins
LeetCode Daily Hard Array Stack Monotonic-Stack Dynamic-Programming Geometry Histogram
Solving the Largest Rectangle in Histogram problem using monotonic stack approach
LeetCode 739: Daily Temperatures
·2 mins
LeetCode Daily Medium Array Stack Monotonic-Stack Data-Structures Temperature Waiting-Time
Solving the Daily Temperatures problem using monotonic stack approach
LeetCode 3644: Maximum K to Sort a Permutation
·2 mins
LeetCode Medium Bit-Manipulation Array
LeetCode 3644 note: every misplaced number must be swapped, so each bit of k must belong to all of them; the answer is the AND of every misplaced number
LeetCode 3643: Flip Square Submatrix Vertically
·2 mins
LeetCode Easy Two-Pointers Matrix
LeetCode 3643 note: flip only the submatrix rows, swapping the slices of rows x + i and x + k - 1 - i
LeetCode 22: Generate Parentheses
·2 mins
LeetCode Daily Medium String Backtracking Recursion Combinatorics Parentheses
Generating all valid parentheses combinations using backtracking approach
LeetCode 20: Valid Parentheses
·2 mins
LeetCode Daily Easy String Stack Data-Structures Parentheses Validation
Solving the Valid Parentheses problem using stack-based approach
LeetCode 1696: Jump Game VI
·2 mins
LeetCode Medium Dynamic-Programming Monotonic-Queue Queue Heap
LeetCode 1696 note: dp[i] = nums[i] + max of the previous k dp values, with that max kept by a monotonic deque in O(n)
LeetCode 155: Min Stack
·2 mins
LeetCode Daily Medium Stack Constant-Time Data-Structures Design Tuple
Implementing a stack with O(1) minimum retrieval using tuple-based approach
LeetCode 150: Evaluate Reverse Polish Notation
·2 mins
LeetCode Daily Medium Stack Data-Structures Expression-Evaluation Math Postfix-Notation Reverse-Polish-Notation
Solving the Reverse Polish Notation evaluation problem using stack-based approach