> For the complete documentation index, see [llms.txt](https://algorithm.prettylog.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://algorithm.prettylog.com/algorithm-problems.md).

# Algorithm Problems

- [Problem Sources](https://algorithm.prettylog.com/algorithm-problems/problem-sources.md)
- [AlgoExpert](https://algorithm.prettylog.com/algorithm-problems/algoexpert.md)
- [Hardest](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hardest.md)
- [Merge Sort](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hardest/merge-sort.md)
- [Hard](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard.md)
- [Prim’s Algorithm](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/prims-algorithm.md)
- [Dijkstra’s Algorithm](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/dijkstras-algorithm.md)
- [Kruskal’s algorithm vs Prim’s algorithm](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/kruskals-algorithm-vs-prims-algorithm.md)
- [Topological Sort](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/topological-sort.md)
- [Max Sum Increasing Subsequence](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/max-sum-increasing-subsequence.md)
- [Find Nodes Distance K](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/find-nodes-distance-k.md)
- [Max Path Sum In Binary Tree](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/max-path-sum-in-binary-tree.md)
- [Validate Three Nodes](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/validate-three-nodes.md)
- [Same BST ?](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/same-bst.md)
- [Zigzag Traverse](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/zigzag-traverse.md)
- [Min Rewards](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/min-rewards.md)
- [Largest Range](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/largest-range.md)
- [Subarray Sort](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/subarray-sort.md)
- [Four Number Sum](https://algorithm.prettylog.com/algorithm-problems/algoexpert/hard/four-number-sum.md)
- [Medium](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium.md)
- [Missing Numbers](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/missing-numbers.md)
- [Beat Seat](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/beat-seat.md)
- [Suffix Trie Construction](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/suffix-trie-construction.md)
- [One Edit](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/one-edit.md)
- [Minimum Characters For Words](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/minimum-characters-for-words.md)
- [Reverse Words in String](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/reverse-words-in-string.md)
- [Valid IP Addresses](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/valid-ip-addresses.md)
- [Group Anagrams](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/group-anagrams.md)
- [Longest Palindromic Substring](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/longest-palindromic-substring.md)
- [Next Greater Element](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/next-greater-element.md)
- [Sort Stack ⇒ recursive good -](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/sort-stack-recursive-good.md)
- [Sunset Views](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/sunset-views.md)
- [Balanced Brackets](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/balanced-brackets.md)
- [Min Max Stack Construction](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/min-max-stack-construction.md)
- [Three Number Sort ⇒ counting sort or radix sort ⇒ three pointer with in-place swap](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/three-number-sort-counting-sort-or-radix-sort-three-pointer-with-in-place-swap.md)
- [Staircase Traversal ⇒ it is like the number of ways to change](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/staircase-traversal-it-is-like-the-number-of-ways-to-change.md)
- [Phone Number Mnemonics ⇒ can use word and index to create each case without concatenation](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/phone-number-mnemonics-can-use-word-and-index-to-create-each-case-without-concatenation.md)
- [Power Set](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/power-set.md)
- [Permutations -](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/permutations.md)
- [Merging LinkedLists](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/merging-linkedlists.md)
- [Sum Of Linked Lists -](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/sum-of-linked-lists.md)
- [Remove Kth Node From End -](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/remove-kth-node-from-end.md)
- [Linked List Construction - Doubly Linked List ?](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/linked-list-construction-doubly-linked-list.md)
- [Min Heap Construction](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/min-heap-construction.md)
- [Valid Starting City](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/valid-starting-city.md)
- [Task Assignment - use two pointer](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/task-assignment-use-two-pointer.md)
- [Two Colorable - Graph](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/two-colorable-graph.md)
- [Minimum Passes Of Matrix](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/minimum-passes-of-matrix.md)
- [Cycle in Graph -](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/cycle-in-graph.md)
- [Remove Islands -](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/remove-islands.md)
- [Youngest Common Ancestor](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/youngest-common-ancestor.md)
- [River Sizes -](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/river-sizes.md)
- [Breadth First Search](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/breadth-first-search.md)
- [Single Cycle Check](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/single-cycle-check.md)
- [Union Find](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/union-find.md)
- [Stable Internships](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/stable-internships.md)
- [Kadane’s Algorithm](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/kadanes-algorithm.md)
- [Levenshtein Distance](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/levenshtein-distance.md)
- [Min Number Of Coins For Change](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/min-number-of-coins-for-change.md)
- [Number Of Ways To Make Change](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/number-of-ways-to-make-change.md)
- [Number Of Ways To Traverse Graph](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/number-of-ways-to-traverse-graph.md)
- [Max Subset Sum No Adjacent](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/max-subset-sum-no-adjacent.md)
- [Symmetrical Tree](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/symmetrical-tree.md)
- [Merge Binary Trees](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/merge-binary-trees.md)
- [Height Balanced Binary Tree](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/height-balanced-binary-tree.md)
- [Find Successor](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/find-successor.md)
- [Binary Tree Diameter](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/binary-tree-diameter.md)
- [Invert Binary Tree](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/invert-binary-tree.md)
- [Reconstruct Bst](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/reconstruct-bst.md)
- [Find Kth Largest Value In Bst](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/find-kth-largest-value-in-bst.md)
- [Min Height BST](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/min-height-bst.md)
- [BST Traversal](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/bst-traversal.md)
- [Validate Bst](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/validate-bst.md)
- [BST Construction](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/bst-construction.md)
- [Zero Sum Subarray + find indices of sub array](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/zero-sum-subarray-+-find-indices-of-sub-array.md)
- [Merge Overlapping Intervals](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/merge-overlapping-intervals.md)
- [First Duplicate Number](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/first-duplicate-number.md)
- [Array of Products](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/array-of-products.md)
- [Longest Peak](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/longest-peak.md)
- [Spiral Traverse](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/spiral-traverse.md)
- [Monotonic Array](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/monotonic-array.md)
- [Move Element To End](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/move-element-to-end.md)
- [Smallest Difference](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/smallest-difference.md)
- [Three Number Sum](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/three-number-sum.md)
- [Easy](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy.md)
- [Middle Node](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/middle-node.md)
- [Evaluate Expression Tree](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/evaluate-expression-tree.md)
- [Insertion Sort](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/insertion-sort.md)
- [Semordnilap](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/semordnilap.md)
- [First Non Repeating Character](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/first-non-repeating-character.md)
- [Generate Document](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/generate-document.md)
- [Run Length Encoding](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/run-length-encoding.md)
- [Caesar Cipher Encryptor](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/caesar-cipher-encryptor.md)
- [Palindrome Check](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/palindrome-check.md)
- [Selection Sort](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/selection-sort.md)
- [Bubble Sort](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/bubble-sort.md)
- [Find Three Largest Sum](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/find-three-largest-sum.md)
- [Binary Search](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/binary-search.md)
- [Product Sum](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/product-sum.md)
- [Nth Fibonacci](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/nth-fibonacci.md)
- [Remove Duplicates From LinkedList](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/remove-duplicates-from-linkedlist.md)
- [Tandem Bicycle](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/tandem-bicycle.md)
- [Class Photos](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/class-photos.md)
- [Minimum Waiting Time](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/minimum-waiting-time.md)
- [Depth-first Search](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/depth-first-search.md)
- [Node Depths](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/node-depths.md)
- [Branch Sums](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/branch-sums.md)
- [Find Closest Value In Bst](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/find-closest-value-in-bst.md)
- [Non Constructible Change](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/non-constructible-change.md)
- [Tournament Winner](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/tournament-winner.md)
- [Sorted Squared Array](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/sorted-squared-array.md)
- [Validate Subsequences](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/validate-subsequences.md)
- [Two Number Sum](https://algorithm.prettylog.com/algorithm-problems/algoexpert/easy/two-number-sum.md)
- [Daily Algorithms](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms.md)
- [1. Topological Sort](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/1.-topological-sort.md): class prerequisites
- [2. MST- Prim, Kruskal](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/2.-mst-prim-kruskal.md)
- [3. Cycle in a Graph](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/3.-cycle-in-a-graph.md): See Graph
- [\[Algo\] Cycle in Graph (directed)](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/3.-cycle-in-a-graph/algo-cycle-in-graph-directed.md): check if there is a cycle in a directed graph
- [4. Maximum sub array sum](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum.md)
- [Problem](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/problem.md)
- [Solutions](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/solutions.md)
- [Brute Force](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/solutions/brute-force.md)
- [Divide And Conquer](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/solutions/divide-and-conquer.md)
- [Kadane's Algorithm - Dynamic](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/solutions/kadanes-algorithm-dynamic.md)
- [Empty Array allowed](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/empty-array-allowed.md)
- [Empty Array not allowed](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/empty-array-not-allowed.md)
- [Empty Array Not Allowed + circular](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/empty-array-not-allowed-+-circular.md)
- [Double array:: O(N), O(N)](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/empty-array-not-allowed-+-circular/double-array-o-n-o-n.md)
- [minimum subarray:: O(N), O(1)](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/4.-maximum-sub-array-sum/empty-array-not-allowed-+-circular/minimum-subarray-o-n-o-1.md)
- [5. Detect a Cycle in a graph with a disjoint set (Union Find)](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/5.-detect-a-cycle-in-a-graph-with-a-disjoint-set-union-find.md)
- [6. Kruskal's Algorithm - Union Find](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/6.-kruskals-algorithm-union-find.md)
- [7. Prim's Algorithm - Priority Queue](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/7.-prims-algorithm-priority-queue.md)
- [8. Sort Array nlogn](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/8.-sort-array-nlogn.md)
- [9. Shortest path - BFS](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/9.-shortest-path-bfs.md)
- [10. Dijkstra algorithm](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/10.-dijkstra-algorithm.md)
- [11. Minimum spanning tree - points](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/11.-minimum-spanning-tree-points.md)
- [12. Minimum depth in a binary tree](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/12.-minimum-depth-in-a-binary-tree.md)
- [13. \[Counting Sort\]: H-index](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/13.-counting-sort-h-index.md)
- [14. \[shortest path\]: Floyd-Warshall](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/14.-shortest-path-floyd-warshall.md)
- [15. \[Linked List\]: reverse list](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/15.-linked-list-reverse-list.md)
- [16. \[Linked List\]: swap nodes in pairs](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/16.-linked-list-swap-nodes-in-pairs.md)
- [17.\[Linked List\]: Merge k Sorted Lists](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/17.-linked-list-merge-k-sorted-lists.md)
- [18.\[Linked list\]:234. Palindrome Linked List](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/18.-linked-list-234.-palindrome-linked-list.md)
- [19. \[Linked List\]: Linked List Cycle](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/19.-linked-list-linked-list-cycle.md)
- [20. \[Linked List\] Reverse Linked List II](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/20.-linked-list-reverse-linked-list-ii.md)
- [21. \[Linked List\] sort a list - asc](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/21.-linked-list-sort-a-list-asc.md)
- [22. \[Sort\] Quick Sort](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/22.-sort-quick-sort.md)
- [23. \[matrix\] Spiral Matrix](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/23.-matrix-spiral-matrix.md)
- [24. \[matrix\] Number of Islands](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/24.-matrix-number-of-islands.md)
- [25. \[matrix\] Valid Sudoku](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/25.-matrix-valid-sudoku.md)
- [26. \[matrix\] Sudoku Solver](https://algorithm.prettylog.com/algorithm-problems/daily-algorithms/26.-matrix-sudoku-solver.md)
