swadhinbiswas feat: new feacture added · 8/31/2026
6500ca6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Lightweight LeetCode problem -> DSA pattern classifier.
export const PATTERN_KEYWORDS: [string, string][] = [
['two sum', 'Arrays & Hashing'],
['hash', 'Arrays & Hashing'],
['anagram', 'Arrays & Hashing'],
['duplicate', 'Arrays & Hashing'],
['contains', 'Arrays & Hashing'],
['group', 'Arrays & Hashing'],
['array', 'Arrays & Hashing'],
['interval', 'Intervals'],
['meeting', 'Intervals'],
['slots', 'Intervals'],
['skyline', 'Intervals'],
['two pointers', 'Two Pointers'],
['palindrome', 'Two Pointers'],
['three sum', 'Two Pointers'],
['3sum', 'Two Pointers'],
['container', 'Two Pointers'],
['sliding window', 'Sliding Window'],
['substring', 'Sliding Window'],
['subarray', 'Sliding Window'],
['stack', 'Stack'],
['parentheses', 'Stack'],
['binary search', 'Binary Search'],
['binary', 'Binary Search'],
['search in', 'Binary Search'],
['koko', 'Binary Search'],
['median', 'Binary Search'],
['sqrt', 'Binary Search'],
['linked list', 'Linked List'],
['remove nth', 'Linked List'],
['merge two', 'Linked List'],
['reverse', 'Linked List'],
['cycle', 'Linked List'],
['binary tree', 'Trees'],
['inorder', 'Trees'],
['preorder', 'Trees'],
['level order', 'Trees'],
['max depth', 'Trees'],
['lowest common', 'Trees'],
['tree', 'Trees'],
['bst', 'Trees'],
['graph', 'Graphs'],
['course schedule', 'Graphs'],
['number of islands', 'Graphs'],
['island', 'Graphs'],
['topological', 'Graphs'],
['word ladder', 'Graphs'],
['heap', 'Heaps'],
['priority', 'Heaps'],
['kth largest', 'Heaps'],
['top k', 'Heaps'],
['backtracking', 'Backtracking'],
['combination', 'Backtracking'],
['permutation', 'Backtracking'],
['subsets', 'Backtracking'],
['letter combinations', 'Backtracking'],
['dynamic programming', 'Dynamic Programming'],
[' dp ', 'Dynamic Programming'],
['coin change', 'Dynamic Programming'],
['house robber', 'Dynamic Programming'],
['climbing stairs', 'Dynamic Programming'],
['unique paths', 'Dynamic Programming'],
['word break', 'Dynamic Programming'],
['longest', 'Dynamic Programming'],
['edit distance', 'Dynamic Programming'],
['regex', 'Dynamic Programming'],
['wildcard', 'Dynamic Programming'],
['decode', 'Dynamic Programming'],
['partition equal', 'Dynamic Programming'],
['subsequence', 'Dynamic Programming'],
['paint house', 'Dynamic Programming'],
['trie', 'Trie'],
['prefix', 'Trie'],
['implement trie', 'Trie'],
['bit', 'Bit Manipulation'],
['xor', 'Bit Manipulation'],
['missing number', 'Bit Manipulation'],
['string to integer', 'Math'],
['reverse integer', 'Math'],
['pow', 'Math'],
['math', 'Math'],
['sqrt', 'Math'],
['lru', 'Design'],
['design', 'Design'],
['min stack', 'Design'],
['serialize', 'Design'],
['union find', 'Union Find'],
['redundant', 'Union Find'],
['alien', 'Union Find'],
['greedy', 'Greedy'],
['jump game', 'Greedy'],
['best time', 'Greedy'],
['maximum subarray', 'Greedy'],
['divid', 'Divide & Conquer'],
['sort an array', 'Sorting'],
['merge sorted', 'Sorting'],
['k closest', 'Heaps'],
['k smallest', 'Heaps'],
['k nearest', 'Heaps'],
['find k', 'Heaps'],
['top k', 'Heaps'],
['matrix', 'Matrix'],
['rotate', 'Matrix'],
['spiral', 'Matrix'],
['sudoku', 'Matrix'],
['set matrix', 'Matrix'],
];
export function classifyPattern(title: string): string {
const lower = ` ${title.toLowerCase()} `;
for (const [kw, pattern] of PATTERN_KEYWORDS) {
if (lower.includes(` ${kw} `) || lower.includes(kw)) return pattern;
}
return 'Core Algorithms';
}