> For the complete documentation index, see [llms.txt](https://l.naveenmuthusamy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://l.naveenmuthusamy.com/readme.md). Agents can also search and read this documentation through its [MCP server](https://l.naveenmuthusamy.com/~gitbook/mcp).

# Introduction

English translation is in progress... Some articles are still in Chinese, but most are completed. Please **star** this repo. The full translation will eventually be finished. Enjoy.

These articles go over different kinds of **Algorithmic Thinking**. All are based on LeetCode problems. They contain **not just the solution code for a problem, but also WHY the solution works and HOW you too can figure it out**.

I don't like one-liners. They can be confusing. I like clear, easily understandable code.

The **Gitbook** has been deployed and will sync with this branch of the repo: <https://labuladong.gitbook.io/algo-en/>

If you would like to clone this repo, please use following command:

```shell
git clone --depth 1  --branch english https://github.com/labuladong/fucking-algorithm.git
```

This command specifies the `english` branch and will limit the depth of the clone and get rid of the Git commit history, which can be faster to clone.

## Table of Contents

* 0 . Must Read Series
  * [The Framework for Learning Algorithms and intense problem solving exercises](https://l.naveenmuthusamy.com/ii.-data-structure/framework-and-thoughts-about-learning-data-structure-and-algorithm.md)
  * [Algs4: Recommended book for Learning Algorithms and Data Structures](https://l.naveenmuthusamy.com/ii.-data-structure/why_i_recommend_algs4.md)
  * [An analysis of Dynamic Programming](https://l.naveenmuthusamy.com/i.-dynamic-programming/analysisofdynamicprogramming.md)
  * [Dynamic Programming Q\&A - What is Optimal Substructure](https://l.naveenmuthusamy.com/i.-dynamic-programming/optimalsubstructure.md)
  * [The Framework for Backtracking Algorithm](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/detailsaboutbacktracking.md)
  * [Binary Search in Detail: I wrote a Poem](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/detailedbinarysearch.md)
  * [The Sliding Window Technique](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/slidingwindowtechnique.md)
  * [Difference Between Process and Thread in Linux](https://l.naveenmuthusamy.com/v.-common-knowledge/linuxprocess.md)
  * [Some Good Online Practice Platforms](https://l.naveenmuthusamy.com/v.-common-knowledge/onlinepraticeplatform.md)
* I. Dynamic Programming Series
  * [Dynamic Programming in Details](https://l.naveenmuthusamy.com/i.-dynamic-programming/analysisofdynamicprogramming.md)
  * [Dynamic Programming Q\&A - What is Optimal Substructure](https://l.naveenmuthusamy.com/i.-dynamic-programming/optimalsubstructure.md)
  * [Classic DP: Longest Common Subsequence](https://l.naveenmuthusamy.com/i.-dynamic-programming/longestcommonsubsequence.md)
  * [Classic DP: Edit Distance](https://l.naveenmuthusamy.com/i.-dynamic-programming/editdistance.md)
  * [Classic DP: Super Egg](https://l.naveenmuthusamy.com/i.-dynamic-programming/throwingeggsinhighbuildings.md)
  * [Classic DP: Super Egg (Advanced Solution)](https://l.naveenmuthusamy.com/i.-dynamic-programming/supereggdropadvanced.md)
  * [The Strategies of Subsequence Problem](https://l.naveenmuthusamy.com/i.-dynamic-programming/strategiesforsubsequenceproblem.md)
  * [Classic DP: Game Problems](https://l.naveenmuthusamy.com/i.-dynamic-programming/gameproblemsindynamicprogramming.md)
  * [Greedy: Interval Scheduling](https://l.naveenmuthusamy.com/i.-dynamic-programming/intervalscheduling.md)
  * [KMP Algorithm In Detail](https://l.naveenmuthusamy.com/i.-dynamic-programming/kmpcharactermatchingalgorithmindynamicprogramming.md)
  * [A solution to all Buy Time to Buy and Sell Stock Problems](https://l.naveenmuthusamy.com/i.-dynamic-programming/besttimetobuyandsellstock.md)
  * [A solution to all House Robber Problems](https://l.naveenmuthusamy.com/i.-dynamic-programming/houserobber.md)
  * [4 Keys Keyboard](https://l.naveenmuthusamy.com/i.-dynamic-programming/fourkeyskeyboard.md)
  * [Regular Expression](https://l.naveenmuthusamy.com/i.-dynamic-programming/regularexpression.md)
  * [Longest Increasing Subsequence](https://l.naveenmuthusamy.com/i.-dynamic-programming/longestincreasingsubsequence.md)
* II. Data Structures Series
  * [The Framework for Learning Algorithms and intense problem solving exercises](https://l.naveenmuthusamy.com/ii.-data-structure/framework-and-thoughts-about-learning-data-structure-and-algorithm.md)
  * [Algs4: Recommended book for Learning Algorithms and Data Structures](https://l.naveenmuthusamy.com/ii.-data-structure/why_i_recommend_algs4.md)
  * [Binary Heap and Priority Queue](https://l.naveenmuthusamy.com/ii.-data-structure/binary_heap_implements_priority_queues.md)
  * [LRU Cache Strategy in Detail](https://l.naveenmuthusamy.com/ii.-data-structure/lru_algorithm.md)
  * [Collections of Binary Search Operations](https://l.naveenmuthusamy.com/ii.-data-structure/the_manipulation_collection_of_binary_search_tree.md)
  * [Special Data Structure: Monotonic Stack](https://l.naveenmuthusamy.com/ii.-data-structure/monotonicstack.md)
  * [Special Data Structure: Monotonic Queue](https://l.naveenmuthusamy.com/ii.-data-structure/monotonic_queue.md)
  * [Design Twitter](https://l.naveenmuthusamy.com/ii.-data-structure/design_twitter.md)
  * [Reverse Part of Linked List via Recursion](https://l.naveenmuthusamy.com/ii.-data-structure/reverse_part_of_a_linked_list_via_recursion.md)
  * [Queue Implement Stack/Stack implement Queue](https://l.naveenmuthusamy.com/ii.-data-structure/implementqueueusingstacksimplementstackusingqueues.md)
* III. Algorithmic Thinking Series
  * [My Way to Learn Algorithm](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/thewaytoalgorithmlearning.md)
  * [The Framework of Backtracking Algorithm](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/detailsaboutbacktracking.md)
  * [Binary Search in Detail](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/detailedbinarysearch.md)
  * [Backtracking Solve Subset/Permutation/Combination](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/subset_permutation_combination.md)
  * [Diving into the technical parts of Double Pointers](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/double_pointer.md)
  * [Sliding Window Technique](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/slidingwindowtechnique.md)
  * [The Core Concept of TwoSum Problems](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/the_key_to_resolving_twosum_problems.md)
  * [Common Bit Manipulations](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/commonbitmanipulation.md)
  * [Breaking down a Complicated Problem: Implement a Calculator](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/implementing_the_functions_of_a_calculator.md)
  * [Pancake Sorting Algorithm](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/pancakessorting.md)
  * [Prefix Sum: Intro and Concept](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/prefix_sum.md)
  * [String Multiplication](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/string_multiplication.md)
  * [FloodFill Algorithm in Detail](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/flood_fill.md)
  * [Interval Scheduling: Interval Merging](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/intervalmerging.md)
  * [Interval Scheduling: Intersections of Intervals](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/intervalintersection.md)
  * [Russian Doll Envelopes Problem](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/russiandollenvelopes.md)
  * [A collection of counter-intuitive Probability Problems](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/several_counter_intuitive_probability_problems.md)
  * [Shuffle Algorithm](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/shuffle_algorithm.md)
  * [Recursion In Detail](https://l.naveenmuthusamy.com/iii.-algorithmic-thinking/recursionindetail.md)
* IV. High Frequency Interview Series
  * [How to Implement LRU Cache](https://l.naveenmuthusamy.com/ii.-data-structure/lru_algorithm.md)
  * [How to Find Prime Number Efficiently](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/print_primenumbers.md)
  * [How to Calculate Minimium Edit Distance](https://l.naveenmuthusamy.com/i.-dynamic-programming/editdistance.md)
  * [How to use Binary Search](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/usingbinarysearchalgorithm.md)
  * [How to efficiently solve Trapping Rain Water Problem](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/trapping_rain_water.md)
  * [How to Remove Duplicates From Sorted Array](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/removeduplicatesfromsortedarray.md)
  * [How to Find Longest Palindromic Substring](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/thelongestpalindromicsubstring.md)
  * [How to Reverse Linked List in K Group](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/reverse-nodes-in-k-group.md)
  * [How to Check the Validation of Parenthesis](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/valid-parentheses.md)
  * [How to Find Missing Element](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/missing_elements.md)
  * [How to Find Duplicates and Missing Elements](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/find-duplicate-and-missing-element.md)
  * [How to Check Palindromic LinkedList](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/check_palindromic_linkedlist.md)
  * [How to Pick Elements From an Infinite Arbitrary Sequence](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/reservoirsampling.md)
  * [How to Schedule Seats for Students](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/seatscheduling.md)
  * [Union-Find Algorithm in Detail](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/union-find-explanation.md)
  * [Union-Find Application](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/union-find-application.md)
  * [Problems that can be solved in one line](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/one-line-code-puzzles.md)
  * [Find Subsequence With Binary Search](https://l.naveenmuthusamy.com/iv.-high-frequency-interview-problem/findsebesquencewithbinarysearch.md)
* V. Common Knowledge
  * [Difference Between Process and Thread in Linux](https://l.naveenmuthusamy.com/v.-common-knowledge/linuxprocess.md)
  * [This is the only article you need to understand `session` and `cookie`](https://l.naveenmuthusamy.com/v.-common-knowledge/sessionandcookie.md)
  * [Knowledge about Linux Shell that you should know](https://l.naveenmuthusamy.com/v.-common-knowledge/linuxshell.md)
  * [Cryptology Algorithm](https://l.naveenmuthusamy.com/v.-common-knowledge/cryptology.md)
  * [Git/SQL/Good Online Practice Platforms](https://l.naveenmuthusamy.com/v.-common-knowledge/onlinepraticeplatform.md)
