LEETCODE

Solutions, written up.

279 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.

  1. 2911Minimum Changes to Make K Semi-palindromesTwo Pointers · String · Dynamic Programminghard
  2. 2243Calculate Digit Sum of a StringString · Simulationeasy
  3. 1524Number of Sub-arrays With Odd SumArray · Math · Dynamic Programming · Prefix Summedium
  4. 273Integer to English WordsMath · String · Recursionhard
  5. 3364Minimum Positive Sum SubarrayArray · Sliding Window · Prefix Sumeasy
  6. 3420Count Non-Decreasing Subarrays After K OperationsArray · Stack · Segment Tree · Sliding Window · Monotonic Stackhard
  7. 3105Longest Strictly Increasing or Strictly Decreasing SubarrayArrayeasy
  8. 262Trips and UsersDatabasehard
  9. 3789Minimum Cost to Acquire Required ItemsMath · Greedymedium
  10. 3693Climbing Stairs IIArray · Dynamic Programmingmedium
  11. 1606Find Servers That Handled Most Number of RequestsArray · Heap (Priority Queue) · Simulationhard
  12. 1267Count Servers that CommunicateArray · Depth-First Search · Breadth-First Search · Matrix · Countingmedium
  13. 1882Process Tasks Using ServersArray · Heap (Priority Queue)medium
  14. 2747Count Zero Request ServersArray · Hash Table · Sliding Window · Sortingmedium
  15. 1385Find the Distance Value Between Two ArraysArray · Two Pointers · Binary Search · Sortingeasy
  16. 239Sliding Window MaximumArray · Sliding Window · Heap (Priority Queue)hard
  17. 3505Minimum Operations to Make Elements Within K Subarrays EqualArray · Hash Table · Math · Dynamic Programming · Sliding Window · Heap (Priority Queue)hard
  18. 3736Minimum Moves to Equal Array Elements IIIArray · Matheasy
  19. 233Number of Digit OneMath · Dynamic Programming · Recursionhard
  20. 462Minimum Moves to Equal Array Elements IIArray · Math · Sortingmedium
  21. 453Minimum Moves to Equal Array ElementsArray · Mathmedium
  22. 3665Twisted Mirror Path CountArray · Dynamic Programming · Matrixmedium
  23. 3970Shortest Path With At Most K Consecutive Identical CharactersGraph · String · Heap (Priority Queue) · Shortest Pathmedium
  24. 3841Palindromic Path Queries in a TreeArray · String · Divide and Conquer · Bit Manipulation · Tree · Depth-First Search · Binary Indexed Tree · Segment Treehard
  25. 3882Minimum XOR Path in a GridArray · Dynamic Programming · Bit Manipulation · Matrixmedium