ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1
KeywordsInput Data StructureAlgorithm PatternExamplesNotes
2
Kth largest / smallest / closest / frequent elementArrayHeapLeetcode 215: Given an integer array nums and an integer k, return the kth largest element in the array.

3
Leetocde 973: Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0)
4
Leetcode 347: Given an integer array nums and an integer k, return the k most frequent elements.
5
6
longest / mimimum / maximum / continuous subsequence / substring such that
Array / StringSliding WindowLeetcode 904: Find the longest continuous sub array that has exactly 2 distinct elements
7
Leetcode 76: Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window.
8
Leetcode 3: Given a string s, return the length of the longest substring without repeating characters.
9
10
continuous substring / subarray of length k Array / StringFixed-Length Sliding Window Leetcode 1876: Substrings of size 3 with distinct characters
11
Leetcode 1456: Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length k.

12
13
subtree, path not through the rootBinary TreeRecursive DFSLeetcode 508: Given the root of a binary tree, return the most frequent subtree sum. If there is a tie, return all the values with the highest frequency in any order.

14
Leetcode 124: A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need to pass through the root.
15
Leetcode 543: Given the root of a binary tree, return the length of the diameter of the tree.

The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root.
16
Leetcode 687: Given the root of a binary tree, return the length of the longest path, where each node in the path has the same value. This path may or may not pass through the root.

17
levelBinary TreeLevel-Order BFSLeetcode 103: Given the root of a binary tree, return the zigzag level order traversal of its nodes' values.
18
Leetcode 662: Given the root of a binary tree, return the maximum width of the given tree.

The maximum width of a tree is the maximum width among all levels.

19
Leetcode 515: Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).
20
Leetcode 199: Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. In other words, return the rightmost node at each level of the tree.
21
path, root-to-leaf pathBinary TreeRecursive DFSLeetcode 112: Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.
22
Leetcode 113: Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. Each path should be returned as a list of the node values, not node references.
23
24
next smallest / largest elementArrayMonotonic StackLeetcode 739: Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature.

25
26
27
return all possible VariesBacktrackingLeetcode 17: Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.
28
Leetcode 131: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.
29
Leetcode 78: Given an integer array nums of unique elements, return all possible subsets
30
Leetcode 22: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
31
find / search in sorted arrayarrayBinary SearchLeetcode 153: Given the sorted rotated array nums of unique elements, return the minimum element of this array.
32
Leetcode 33: There is an integer array nums sorted in ascending order (with distinct values).

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.
33
34
Minumum number / shortest path / nearest neighborGraph / 2D MatrixBFSLeetcode 994: You are given an m x n grid where each cell can have one of three values...Return the minimum number of minutes that must elapse until no cell has a fresh orange.
35
Leetcode 542: Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell.
36
continuous subarray sumarrayPrefix SumLeetcode 560: Given an array of integers and an integer k, find the total number of continuous subarrays whose sum equals k.
37
Leetcode 523: Given an array of integers, check if there exists a subarray whose sum is a multiple of a given number.
38
Leetcode 437: Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum. (Note: treat the path like an array)
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100