# LeetCode Problem Classification

An algorithm problem contains 3 parts: the input, the output and the solution. The input data structures can be an array, string, tree, liked list, matrix, etc. The algorithm used to solve the problem can be dynamic programming, BFS and DFS. It can also be a data structure, such as a heap, stack, hash set, hash map, etc. In this post, the algorithm problems are classified by their input data structure. Under each categories, the problems are tagged with their algorithm or data structure used to solve the problem.

1. Array/String

--classic array problem--
Kth Largest Element in an Array
Remove K Digits

--Finding a Number--
Missing Number
Find the duplicate number
First Missing Positive

--Binary Search--
Median of Two Sorted Arrays
Search Insert Position
Find Minimum in Rotated Sorted Array: I, II
Search for a Range
Guess Number Higher or Lower
First Bad Version
Search in Rotated Array:I, II
Longest Increasing Subsequence
Russian Doll Envelopes

--Stack--Largest Rectangle--
Largest Rectangle in Histogram
Maximal Rectangle

--Stack--Nested Object--
Mini Parser
Flatten Nested List Iterator
Nested List Weight Sum
Nested List Weight Sum II (HashMap)
Longest Absolute File Path
Decode String

--Caching--
Majority Element: I, II
Increasing Triplet Subsequence, Find Top 2 Largest Elements

--Rotate--
Rotate Array, Reverse Words in a String

--Bucket Sort--
Group Anagrams

Lexicographical Numbers

--TreeSet--
Contains Duplicate: I, II, III
Max Sum of Rectangle No Larger Than K
Maximum Sum Of Subarray Close To K

--Track min/max and update result--
H-Index , H-Index II

--Stream--(deque/caching/heap/treeset)
Sliding Window Maximum
Moving Average from Data Stream
Find Median from Data Stream
Data Stream as Disjoint Intervals

--Interval--
Merge Intervals
Insert Interval

--Segment Tree & Binary Index Tree--
Range Sum Query - Mutable
The Skyline Problem

--Graph--(mainly topological sort)--
Clone Graph
Course Schedule , Course Schedule II , Minimum Height Trees
Reconstruct Itinerary
Graph Valid Tree

--Maximum subarray--
Maximum Subarray
Maximum Product Subarray

--Word break--
Word Break
Word Break II

--Design data structure with time requirements--
LRU Cache
Insert Delete GetRandom O(1)
Insert Delete GetRandom O(1) - Duplicates allowed
Insert Delete GetMostFrequent O(1)
Design Phone Directory
Design Twitter

--Random--
Linked List Random Node
Shuffle an Array

2. Matrix

--queue--
Design Snake Game

Sparse Matrix Multiplication

3. Linked List

4. Tree

--traveral--
Binary Tree Traversal: Preorder, Inorder, Postorder, Level Order, Level Order II, Vertical Order

--dfs/bfs--

5. Bit Manipulation

6. Math

Category >> Algorithms
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
```<pre><code>
String foo = "bar";
</code></pre>
```