LEETCODE
Solutions, written up.
256 problems I have solved, most of them from the daily challenge. Each page explains the idea behind the solution, gives its complexity, and has the code (mostly Python and Java) that I tested before submitting. The source is on GitHub.
- 3841Palindromic Path Queries in a TreeArray · String · Divide and Conquer · Bit Manipulation · Tree · Depth-First Search · Binary Indexed Tree · Segment Treehard
- 3882Minimum XOR Path in a GridArray · Dynamic Programming · Bit Manipulation · Matrixmedium
- 3619Count Islands With Total Value Divisible by KArray · Depth-First Search · Breadth-First Search · Matrixmedium
- 1254Number of Closed IslandsArray · Depth-First Search · Breadth-First Search · Matrixmedium
- 2409Count Days Spent TogetherMath · Stringeasy
- 220Contains Duplicate IIIArray · Sliding Window · Sorting · Bucket Sorthard
- 3644Maximum K to Sort a PermutationArray · Bit Manipulationmedium
- 3942Minimum Operations to Sort a PermutationArraymedium
- 3863Minimum Operations to Sort a StringStringmedium
- 3886Sum of Sortable IntegersArray · Math · Sorting · Enumerationhard
- 2089Find Target Indices After Sorting ArrayArray · Binary Search · Sortingeasy
- 218The Skyline ProblemArray · Divide and Conquer · Heap (Priority Queue) · Segment Tree · Binary Indexed Treehard
- 1569Number of Ways to Reorder Array to Get Same BSTArray · Math · Divide and Conquer · Dynamic Programming · Tree · Memoization · Combinatorics · Binary Treehard
- 3551Minimum Swaps to Sort by Digit SumArray · Hash Table · Sortingmedium
- 2916Subarrays Distinct Element Sum of Squares IIArray · Hash Table · Binary Indexed Tree · Segment Treehard
- 2913Subarrays Distinct Element Sum of Squares IArray · Hash Tableeasy
- 214Shortest PalindromeString · String Matchinghard
- 3723Maximize Sum of Squares of DigitsMath · Greedymedium
- 3727Maximum Alternating Sum of SquaresArray · Greedy · Sortingmedium
- 2897Apply Operations on Array to Maximize Sum of SquaresArray · Hash Table · Greedy · Bit Manipulationhard
- 2778Sum of Squares of Special ElementsArray · Math · Enumerationeasy
- 212Word Search IIArray · String · Backtracking · Trie · Matrixhard
- 185Department Top Three SalariesDatabasehard
- 2333Minimum Sum of Squared DifferenceArray · Math · Binary Search · Sorting · Heap (Priority Queue) · Greedy · Countingmedium
- 1541Minimum Insertions to Balance a Parentheses StringString · Stack · Greedymedium
- 1021Remove Outermost ParenthesesString · Stackeasy
- 188Best Time to Buy and Sell Stock IVArray · Dynamic Programminghard
- 301Remove Invalid ParenthesesString · Backtracking · Breadth-First Searchhard
- 921Minimum Add to Make Parentheses ValidString · Stack · Greedymedium
- 856Score of ParenthesesString · Stackmedium
- 678Valid Parenthesis StringString · Dynamic Programming · Stack · Greedymedium
- 22Generate ParenthesesString · Dynamic Programming · Backtrackingmedium
- 149Max Points on a LineArray · Hash Table · Math · Geometryhard
- 20Valid ParenthesesString · Stackeasy
- 1111Maximum Nesting Depth of Two Valid Parentheses StringsString · Stack · Greedymedium
- 2267Check if There Is a Valid Parentheses String PathArray · Dynamic Programming · Matrix · Bit Manipulationhard
- 1614Maximum Nesting Depth of the ParenthesesString · Stackeasy
- 132Palindrome Partitioning IIString · Dynamic Programminghard
- 1807Evaluate the Bracket Pairs of a StringArray · Hash Table · Stringmedium
- 1190Reverse Substrings Between Each Pair of ParenthesesString · Stackmedium
- 1096Brace Expansion IIString · Backtracking · Stack · Breadth-First Searchhard
- 3550Smallest Index With Digit Sum Equal to IndexArray · Matheasy
- 126Word Ladder IIHash Table · String · Backtracking · Breadth-First Searchhard
- 1658Minimum Operations to Reduce X to ZeroArray · Hash Table · Binary Search · Sliding Window · Prefix Summedium
- 3525Find X Value of Array IIArray · Math · Segment Treehard
- 3524Find X Value of Array IArray · Math · Dynamic Programmingmedium
- 3498Reverse Degree of a StringString · Simulationeasy
- 123Best Time to Buy and Sell Stock IIIArray · Dynamic Programminghard
- 1401Circle and Rectangle OverlappingMath · Geometrymedium
- 1520Maximum Number of Non-Overlapping SubstringsString · Greedyhard
showing 50 of 256