feat(content): add categories and patterns
This commit is contained in:
60
backend/data/categories/categories.yaml
Normal file
60
backend/data/categories/categories.yaml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
categories:
|
||||||
|
- name: Arrays
|
||||||
|
slug: arrays
|
||||||
|
description: Problems involving array manipulation, traversal, and transformations.
|
||||||
|
|
||||||
|
- name: Strings
|
||||||
|
slug: strings
|
||||||
|
description: Problems focused on string manipulation, pattern matching, and text processing.
|
||||||
|
|
||||||
|
- name: Hash Tables
|
||||||
|
slug: hash-tables
|
||||||
|
description: Problems utilizing hash maps for efficient lookups and counting.
|
||||||
|
|
||||||
|
- name: Linked Lists
|
||||||
|
slug: linked-lists
|
||||||
|
description: Problems involving singly or doubly linked list operations.
|
||||||
|
|
||||||
|
- name: Trees
|
||||||
|
slug: trees
|
||||||
|
description: Problems involving binary trees, BSTs, and tree traversals.
|
||||||
|
|
||||||
|
- name: Graphs
|
||||||
|
slug: graphs
|
||||||
|
description: Problems involving graph traversal, shortest paths, and connectivity.
|
||||||
|
|
||||||
|
- name: Dynamic Programming
|
||||||
|
slug: dynamic-programming
|
||||||
|
description: Problems requiring optimal substructure and overlapping subproblems.
|
||||||
|
|
||||||
|
- name: Binary Search
|
||||||
|
slug: binary-search
|
||||||
|
description: Problems utilizing binary search for efficient searching.
|
||||||
|
|
||||||
|
- name: Sorting
|
||||||
|
slug: sorting
|
||||||
|
description: Problems involving sorting algorithms and techniques.
|
||||||
|
|
||||||
|
- name: Stack
|
||||||
|
slug: stack
|
||||||
|
description: Problems using LIFO data structure for parsing and tracking.
|
||||||
|
|
||||||
|
- name: Queue
|
||||||
|
slug: queue
|
||||||
|
description: Problems using FIFO data structure and BFS traversals.
|
||||||
|
|
||||||
|
- name: Heap
|
||||||
|
slug: heap
|
||||||
|
description: Problems using priority queues for top-k and streaming data.
|
||||||
|
|
||||||
|
- name: Two Pointers
|
||||||
|
slug: two-pointers
|
||||||
|
description: Problems solved using two pointer technique.
|
||||||
|
|
||||||
|
- name: Recursion
|
||||||
|
slug: recursion
|
||||||
|
description: Problems requiring recursive problem decomposition.
|
||||||
|
|
||||||
|
- name: Math
|
||||||
|
slug: math
|
||||||
|
description: Problems involving mathematical concepts and number theory.
|
||||||
129
backend/data/patterns/patterns.yaml
Normal file
129
backend/data/patterns/patterns.yaml
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
patterns:
|
||||||
|
- name: Two Pointers
|
||||||
|
slug: two-pointers
|
||||||
|
description: Use two pointers to traverse data from different positions, often moving toward or away from each other.
|
||||||
|
when_to_use: |
|
||||||
|
- Sorted arrays where you need to find pairs
|
||||||
|
- Linked list cycle detection
|
||||||
|
- Removing duplicates in-place
|
||||||
|
- Partitioning arrays
|
||||||
|
- Palindrome checking
|
||||||
|
|
||||||
|
- name: Sliding Window
|
||||||
|
slug: sliding-window
|
||||||
|
description: Maintain a window of elements that slides through the data, tracking a constraint or computing aggregates.
|
||||||
|
when_to_use: |
|
||||||
|
- Finding subarrays/substrings with specific properties
|
||||||
|
- Maximum/minimum sum of fixed-size windows
|
||||||
|
- Longest substring with at most K distinct characters
|
||||||
|
- Problems mentioning "contiguous" elements
|
||||||
|
|
||||||
|
- name: Fast & Slow Pointers
|
||||||
|
slug: fast-slow-pointers
|
||||||
|
description: Two pointers moving at different speeds, commonly used for cycle detection.
|
||||||
|
when_to_use: |
|
||||||
|
- Detecting cycles in linked lists or arrays
|
||||||
|
- Finding the middle of a linked list
|
||||||
|
- Finding the start of a cycle
|
||||||
|
- Happy number problem
|
||||||
|
|
||||||
|
- name: Binary Search
|
||||||
|
slug: binary-search
|
||||||
|
description: Efficiently search sorted data by repeatedly dividing the search space in half.
|
||||||
|
when_to_use: |
|
||||||
|
- Sorted arrays or search spaces
|
||||||
|
- Finding boundaries (first/last occurrence)
|
||||||
|
- Searching in rotated sorted arrays
|
||||||
|
- Finding peak elements
|
||||||
|
- Minimizing/maximizing with monotonic constraints
|
||||||
|
|
||||||
|
- name: BFS (Breadth-First Search)
|
||||||
|
slug: bfs
|
||||||
|
description: Level-by-level traversal using a queue, optimal for shortest paths in unweighted graphs.
|
||||||
|
when_to_use: |
|
||||||
|
- Shortest path in unweighted graphs
|
||||||
|
- Level-order tree traversal
|
||||||
|
- Finding all nodes at distance K
|
||||||
|
- Word ladder problems
|
||||||
|
- Matrix traversal
|
||||||
|
|
||||||
|
- name: DFS (Depth-First Search)
|
||||||
|
slug: dfs
|
||||||
|
description: Explore as deep as possible before backtracking, using recursion or a stack.
|
||||||
|
when_to_use: |
|
||||||
|
- Tree/graph traversal
|
||||||
|
- Path finding
|
||||||
|
- Detecting cycles
|
||||||
|
- Topological sorting
|
||||||
|
- Connected components
|
||||||
|
- Backtracking problems
|
||||||
|
|
||||||
|
- name: Backtracking
|
||||||
|
slug: backtracking
|
||||||
|
description: Build solutions incrementally, abandoning paths that fail to satisfy constraints.
|
||||||
|
when_to_use: |
|
||||||
|
- Generating all permutations/combinations
|
||||||
|
- Sudoku solver
|
||||||
|
- N-Queens problem
|
||||||
|
- Subset/partition problems
|
||||||
|
- Word search in grid
|
||||||
|
|
||||||
|
- name: Dynamic Programming
|
||||||
|
slug: dynamic-programming
|
||||||
|
description: Break problems into overlapping subproblems, storing results to avoid recomputation.
|
||||||
|
when_to_use: |
|
||||||
|
- Optimization problems (min/max)
|
||||||
|
- Counting problems
|
||||||
|
- Problems with optimal substructure
|
||||||
|
- Sequence alignment
|
||||||
|
- Knapsack-type problems
|
||||||
|
|
||||||
|
- name: Greedy
|
||||||
|
slug: greedy
|
||||||
|
description: Make locally optimal choices at each step, hoping for a global optimum.
|
||||||
|
when_to_use: |
|
||||||
|
- Interval scheduling
|
||||||
|
- Huffman coding
|
||||||
|
- Minimum spanning tree
|
||||||
|
- Activity selection
|
||||||
|
- When local optimum leads to global optimum
|
||||||
|
|
||||||
|
- name: Monotonic Stack
|
||||||
|
slug: monotonic-stack
|
||||||
|
description: Stack maintaining elements in sorted order, used for next greater/smaller element problems.
|
||||||
|
when_to_use: |
|
||||||
|
- Next greater/smaller element
|
||||||
|
- Largest rectangle in histogram
|
||||||
|
- Daily temperatures
|
||||||
|
- Stock span problem
|
||||||
|
- Trapping rain water
|
||||||
|
|
||||||
|
- name: Heap / Priority Queue
|
||||||
|
slug: heap
|
||||||
|
description: Data structure for efficiently finding min/max elements.
|
||||||
|
when_to_use: |
|
||||||
|
- Top K elements
|
||||||
|
- K-way merge
|
||||||
|
- Median from data stream
|
||||||
|
- Task scheduling
|
||||||
|
- Dijkstra's algorithm
|
||||||
|
|
||||||
|
- name: Union Find
|
||||||
|
slug: union-find
|
||||||
|
description: Track disjoint sets with efficient union and find operations.
|
||||||
|
when_to_use: |
|
||||||
|
- Connected components in graphs
|
||||||
|
- Cycle detection in undirected graphs
|
||||||
|
- Kruskal's minimum spanning tree
|
||||||
|
- Social network connections
|
||||||
|
- Accounts merge
|
||||||
|
|
||||||
|
- name: Trie
|
||||||
|
slug: trie
|
||||||
|
description: Tree-like data structure for efficient string prefix operations.
|
||||||
|
when_to_use: |
|
||||||
|
- Autocomplete systems
|
||||||
|
- Word dictionary with wildcard search
|
||||||
|
- Longest common prefix
|
||||||
|
- Word break problems
|
||||||
|
- Spell checker
|
||||||
Reference in New Issue
Block a user